making sure a user name isn't used twice
Posted: Mon Nov 27, 2006 5:01 pm
I'm working on a site for a my friends and I to post our homework. So far I have a lot of it done but I need to make sure a username isn't used twice. How would you go about doing this?
This is what I have so far for the user registration function.
thanks!
This is what I have so far for the user registration function.
Code: Select all
function register($user, $pass, $email, $email_redo) {
if($email != $email_redo) {
header("location: {$page['register']}?msg=emailmatch");
}
$sql = mysql_query("Insert into users (user, pass, email) VALUES('$user', '$pass', '$email')") or die(mysql_error());
$msg = "$user, thank you for siging up on {$site['url']} . \n Your login information is \n user: $user \n password: $pass";
$msg2 = wordwrap($msg, 70);
mail($email, "Your Login information for the hw site", $msg2);
}