I keep receiving the following error..( Error: user account already exists..
) although I don't have any data in my table. Any help would be appreciated.
The code follows:
<?php
session_start();
include ('dbc.php');
if (isset($_POST['Submit']) =='Register')
{
if (strlen($_POST['email']) < 5)
{
die ("Incorrect email. Please enter valid email address..");
}
if (strcmp(isset($_POST['pass1']),isset($_POST['pass2'])) ||
empty($_POST['pass1']) )
{
//die ("Password does not match");
die("ERROR: Password does not match or empty..");
}
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
{
die("Invalid code entered.
Please enter the correct code as shown in the Image");
}
$rs_duplicates = mysql_query("select id from users where
user_email='$_POST[email]'");
$duplicates = mysql_num_rows($rs_duplicates);
if ($duplicates> 0);
{
//die ("ERROR: User account already exists.");
header("Location: register.php?msg=ERROR: User account
already exists..");
exit();
}
$md5pass = md5($_POST['pass2']);
$activ_code = rand(1000,9999);
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
mysql_query("INSERT INTO users
(`user_email`,`user_pwd`,`country`,`joined`,`activation_code`,`full_name`)
VALUES
('$_POST[email]','$md5pass','$_POST[country]',now(),'$activ_code','$_POST[fu
ll_name]')") or die(mysql_error());
$message =
"Thank you for registering an account with $server. Here are the login
details...\n\n
User Email: $_POST[email] \n
Password: $_POST[pass2] \n
Activation Code: $activ_code \n
____________________________________________
*** ACTIVATION LINK ***** \n
Activation Link:
http://$host$uri/activate.php?usr=$_POST[email]&code=$activ_code \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";
mail($_POST['email'] , "Login Activation", $message,
"From: \"Auto-Response\" <notifications@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
unset($_SESSION['ckey']);
echo ("Registration Successful! An activation code has been
sent to your email address with an activation link...");exit;
}
?>