×PLease Fill all fields..!
";
exit();
} else {
if(!preg_match($name,$f_name)){
echo "
×
this $f_name is not valid..!
";
exit();
}
if(!preg_match($name,$l_name)){
echo "
×
this $l_name is not valid..!
";
exit();
}
if(!preg_match($emailValidation,$email)){
echo "
×
this $email is not valid..!
";
exit();
}
if(strlen($password) < 9 ){
echo "
";
exit();
}
if(strlen($repassword) < 9 ){
echo "
";
exit();
}
if($password != $repassword){
echo "
";
}
if(!preg_match($number,$mobile)){
echo "
×
Mobile number $mobile is not valid
";
exit();
}
if(!(strlen($mobile) == 10)){
echo "
×
Mobile number must be 10 digit
";
exit();
}
//existing email address in our database
$sql = "SELECT user_id FROM user_info WHERE email = '$email' LIMIT 1" ;
$check_query = mysqli_query($con,$sql);
$count_email = mysqli_num_rows($check_query);
if($count_email > 0){
echo "
×
Email Address is already available Try Another email address
";
exit();
} else {
$db_sql = "SELECT * FROM user_info";
$db_query = mysqli_query($con, $db_sql);
$count_db = mysqli_num_rows($db_query);
$sql = "INSERT INTO `user_info`
(`user_id`, `first_name`, `last_name`, `email`,
`password`, `mobile`, `address1`, `address2`)
VALUES ($count_db + 1, '$f_name', '$l_name', '$email',
'$password', '$mobile', '$address1', '$address2')";
$run_query = mysqli_query($con,$sql);
$_SESSION["uid"] = mysqli_insert_id($con);
$_SESSION["name"] = $f_name;
$ip_add = getenv("REMOTE_ADDR");
$sql = "UPDATE cart SET user_id = '$_SESSION[uid]' WHERE ip_add='$ip_add' AND user_id = -1";
if(mysqli_query($con,$sql)){
echo "register_success";
echo "";
exit;
}
}
}
}
?>