Hey, im a newbie but i thought id better ask in here as this is concerning MySQL.
Ok well, on my site it has a registration feature. When you register it puts your details into a table called 'pending' after checking to see if there are duplicate entries in auth or userifno. Finally it sends you an email with a randomly generated number. Tjhere are also 2 other tables, auth and userinfo.
When you check your inbox in the email that was sent is a link which takes you to the activae.php page. You type in your code and it copies the info from pending into auth and userinfo. Then it deletes your information from pending.
Ok that all works great!
But earlier today i came across a problem and im not sure who to go about fixing it.
Some one registered, for simplicity we'll use: Pablo
Everything went fine and all was a-ok. Then today someone else came along and registered with the name: pablo
it accepted the 2nd because it was a lower case 'p'. However, when they activated their account it would not add them to auth or userinfo because apparently pablo was a duplicate of Pablo (I have set the username fields as unique in all tables).
Im confused as im not sure how to stop a user adding themselves to the pending table. This is the code i use to check:
//Include the configuration file
include ("config.php");
//Lets check to see if their username is already taken in auth.
$query_checkUsername = "SELECT * FROM auth";
$result = mysql_query($query_checkUsername);
While ($row = mysql_fetch_array($result))
{
if ($row[username] === "$chosenusername") {
header ("location: register.php?error=taken&email=$email&name=$name&location=$location");
exit();
} else {}
}
//Lets check to see if their username is already in the pending list
$query_checkUsername = "SELECT * FROM pending";
$result = mysql_query($query_checkUsername);
While ($row = mysql_fetch_array($result))
{
if ($row[username] === "$chosenusername") {
header ("location: register.php?error=taken&email=$email&name=$name&location=$location");
exit();
} else {}
}
😕
thanks
Pablo de la Pena