email check problem in a sign up script
Posted: Sat Sep 06, 2003 6:00 pm
this section is NOT working right it should error on people using the same e-mail address, yet it allowed a friend to sign up with the same one twice does anyone have any clues?
Code: Select all
elseif($step==3){ # make sure the username, e-mail and passwords are ok
$db=mysql_connect($host, $login1, $pass1) or die("cannot access mysql"); # connect
$fyd=mysql_select_db('findyourdesire', $db) or die("cannot connect to db"); # select the db
$user=mysql_query("SELECT * FROM users WHERE username='$un'",$db); # is there a user by that name?
if(!(preg_match('/\w+/', $un))){$err=TRUE; $errs[]='Your Member Name has invalid characters.<br>Only Alpha-Numeric characters and underscore are accepted'; $step=2;}
elseif(mysql_num_rows($user)>0){$err=TRUE; $errs[]='That name is already in use. Please choose a new Member Name.'; $step=2;}
if(strlen($pw)<6){ $err=TRUE; $errs[]='Your Password <b>MUST</b> be at least 6 characters'; $step=2;}
if($pw!==$pwc){ $err=TRUE; $errs[]='Your Password <b>MUST</b> match the check exactly'; $step=2;}
if(!(preg_match('/^[\w\.\-]+@[\w\.\-]+\.\w\w\w?$/', $email))){$err=TRUE; $errs[]='Your E-Mail address does not appear to be valid'; $step=2;}
else{
$mail=mysql_query("SELECT * FROM users WHERE email='$email'",$db); # was this email used already?
if(mysql_num_rows($mail)>0){ $err=TRUE; $errs[]='You already have an account. Click <a href="pass.php">here</a> to get your username and password sent to you.'; }
}