ok this is my registernext.php
Code: Select all
<?php
include('confff.php');
//test to see if username is alfanumeric
$testname=$_POST['username'];
if(!preg_match('[^0-9a-zA-Z]', $username))
{
//test for duplicate names
$username = $_POST['username'];
$username=strip_tags($username);
$query="SELECT * FROM users WHERE username ='$username'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
if ($num == 0)
{
//test for duplicate emails
$email = $_POST['email'];
$email=strip_tags($email);
$query2="SELECT * FROM users WHERE email ='$email'";
$result2=mysql_query($query2);
$num2=mysql_num_rows($result2);
if($num2==0)
{
//if emails and passwords match up
if(($_POST['pass']==$_POST['pass2']) && ($_POST['email']==$_POST['email2']))
{
//generate random confirmation code
$confirmation_code=md5(uniqid(rand()));
$passkey = $confirmation_code;
$sql="INSERT INTO temp (code, username, email, password) VALUES ('$confirmation_code', '$testname', '$email', '$pass')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
if($sql)
{
$message="Your Confirmation link \r\n
Click on this link to activate your account \r\n
http://www.royalempires.com/confirmation.php?passkey=$confirmation_code";
$sentmail=mail("$email",'Registration Confirmation',"$message" ,'From: admin@royalempires.com');
header("Location:thankyou.html");
}
else
{
echo "Not found your email in our database";
}
//if your email succesfully sent
if($sentmail)
{
echo "Your Confirmation link has been sent to your e-mail account";
}
else
{
echo "cannot send confirmation link to your e-mail adress";
}
}
else
{
header("location:badmatch.html");
}
}
else
{
header("Location:emailinuse.html");
}
}
else
{
header("Location:nameinuse.html");
}
}
?>