case sensitive username

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

case sensitive username

Post 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.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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]()
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

what is the datatype of the username?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not use binary mode on the varchar/text/whatever ?
Post Reply