So i have a php register script on my website which is mysql i have noticed today somebody has registered with the same username has a staff member. I have tryied to do it my self but the if statement stop's me but some how they got past it so i just need to ask what if the different between == and === in php i think i read some were that if i use === it will make it exact.
// here we check to see if the username is all ready in the db
$sql2 = "SELECT `username` FROM `users` WHERE `username` = '" . $user2. "'";
$result2 = mysql_query($sql2) or die(mysql_error());
if (mysql_num_rows($result2)==1) {
echo "A Account Is All Ready Here";
} else {
//
now we made the account
}
I know that i should move over to pdo i think maybe this would fix it
// here we check to see if the username is all ready in the db
$sql2 = "SELECT `username` FROM `users` WHERE `username` = '" . $user2. "'";
$result2 = mysql_query($sql2) or die(mysql_error());
if (mysql_num_rows($result2)===1) {
echo "A Account Is All Ready Here";
} else {
}
The problem is that one users registers has abc and then another registeres with abc <- with a space after it and it says the username is not in use and then when the person logins with the space after the username ti will login them into the normal abc one...