Code: Select all
$user = mysql_real_escape_string($user);
$user = strtolower($user);
$pass = mysql_real_escape_string($pass);
//make sure user exists
$sql = "SELECT * FROM auther WHERE name = '" . $user . "'";
$data = mysql_fetch_array(mysql_query($sql));
if(isset($data['password']) && $data['password']==$pass)
echo "GOOD USER";
//propagate initial table
// $sql = "INSERT INTO auther (name, password, permissions) VALUES('$user', '$pass', 'full')";
// mysql_query($sql);My problem is that I want it to complete ignore capitalization of the username. So if user types "USERNaMe", that should be the same thing as "usernAME". Here are the $sql values for the following usernames (I just used "echo $sql" to get this):
barbARA:
INSERT INTO auther (name, password, permissions) VALUES('barbara', 'thepasswordhash', 'full')
then, I commented out the insert query, and un commented the select query, and got these results:
barbARA:
SELECT * FROM auther WHERE name = 'barbara'GOOD USER
barbara:
SELECT * FROM auther WHERE name = 'barbara'
I can not for the life of me figure out what the difference between those two select statements are, yet one of them gets the result I want, and the other doesn't. Could someone _please_ tell me what I'm missing? Thanks!
Edit: I know for a fact that I was typing the correct password in every single time. I also know for a fact that everything is spelled right... except for the capitalization, which shouldn't be creating this problem.