Upper / Lower case ?

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
WorldCom
Forum Commoner
Posts: 45
Joined: Sat Jun 24, 2006 8:14 am
Location: Ontario, Canada

Upper / Lower case ?

Post by WorldCom »

Hi all,

This is more of an observation without explanation :)
I have a login script using a Domain Name and Password for login.
Eg. test.com

This compares the domain name input to the domain name in the database.
What I did was use:

Code: Select all

$domainname = strtolower($domainname);
> to make sure everything was in lower case when logging in.
My problem (which doesn't really seem to be a problem) is that when users sign up, they may use caps in their domain name. Even though we know it makes no difference. eg. TesT.com
So, in the database it is logged exactly that way.

Yet, I can log in to these domains (with Upper case) when my input should be all lower case.
It logs in fine.
Does MySQL not differentiate between upper and lower?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Depends on the datatype and/or the collation.
see http://dev.mysql.com/doc/refman/5.1/en/ ... ivity.html
WorldCom
Forum Commoner
Posts: 45
Joined: Sat Jun 24, 2006 8:14 am
Location: Ontario, Canada

Post by WorldCom »

Thanks volka,

Exactly what I was looking for.
So, for the configuration I have, my changing the domainname input to lower case is kinda useless.
So my setup is fine for me cause it makes things easier and I can get rid of that line :)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

or you could just lowercase them before you insert them into the database :P
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply