Page 1 of 1

case sensitive username

Posted: Sat Jan 08, 2005 2:36 pm
by shiznatix
i need to make the username case sensitive for a login script thing.

i have it so a html form sends to a mysql query. oddly the password field works as case sensitive but the username part dosnt.

Posted: Sat Jan 08, 2005 2:49 pm
by John Cartwright
what I do I convert all names to lower case when comparing them

[php_man]strtolower[/php_man]()

some similar functions

[php_man]strtoupper[/php_man](), [php_man]ucfirst[/php_man](), [php_man]ucwords[/php_man]()

Posted: Sat Jan 08, 2005 3:50 pm
by timvw
what is the datatype of the username?

Posted: Sat Jan 08, 2005 4:01 pm
by shiznatix
it was text or what not in the mysqldatabase but i figured out a way around it so its alrite. but to change the topic of this post

when you upload a file if there is a ' character in the file name it turns that into a \ mark thus messing up everything. is there a way around this or even a way to just turn the ' into a blank space instead of a \ mark?

Posted: Sat Jan 08, 2005 4:22 pm
by John Cartwright
[php_man]get_magic_quotes_gpc[/php_man]

[php_man]stripslahses[/php_man]
[php_man]addslashes[/php_man]

Read those, should give you a general understanding of it.
But to sum it all up

1. add slashes
2. add to db
3. remove slashes

Posted: Sat Jan 08, 2005 4:41 pm
by timvw
from the mysql manual (text type is case insensitive)
BLOB columns are treated as binary strings, whereas TEXT columns are treated according to their character set. For BLOB columns, sorting and comparison is case sensitive. For TEXT columns, values are sorted and compared based on the collation of the character set assigned to the column as of MySQL 4.1. Before 4.1, TEXT sorting and comparison are based on the collation of the server character set
if you are using mysql you also might want to have a look at
[php_man]mysql_escape[/php_man]
[php_man]mysql_real_escape[/php_man]

Posted: Sat Jan 08, 2005 7:18 pm
by feyd
why not use binary mode on the varchar/text/whatever ?