Eeeee guys my script is working 😃 Thank god lol 😛 like you said igor it was really going nowhere!
Now I have one more tip to ask, this script is just to filter on the client side now on the server side there is some more information I want to filter before register the user on the database.
How can I send the information of this script to another one that will finalize the process?
<?php
require_once 'connection/dbconnect.inc';
//reCaptcha
require_once('includes/recaptchalib.php');
$privatekey = "6LcxMQMAAAAAAHJ0G1cbSZ3_H0n6u-wlRUFRCfee";
//fields taken
$email = $_POST['email'];
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
$accntype = $_POST['accntype'];
$country = $_POST['country'];
$state = $_POST['state'];
$city = $_POST['city'];
$zip = $_POST['zipcode'];
$gender = $_POST['gender'];
$date =$_POST['year']."-".$_POST['month']."-".$_POST['day'];
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
$checkexitingemail=mysql_query("SELECT * FROM users WHERE user_email='".$email."'");
if (mysql_num_rows($checkexitingemail)!=0){ //Check if the email already exists
print "This email already has an account. If you forgot your password click here
<a href='lostpass.php'>lost your password?</a>.<br>";
exit;
}elseif(!eregi("^[[:alnum:]]{8,16}$", $_POST['pass1'])) {
echo "Plese enter a password that consists only of letter and numbers, between 8 and 16 characters long.<BR>";
}elseif ($pass1 != $pass2){
print "Password mismatch. Please enter the same password in both fields.";
exit;
}elseif(!eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$", $_POST['email'])) {
echo"Please enter a valid email address.<BR>";
}elseif($_POST['month'] == "Month" || $_POST['day'] == "Day" || $_POST['year'] == "Year"){
print "Please select your birthdate";
exit;
}elseif (!$resp->is_valid) {
print "Please re-enter the captcha.";
}elseif (!$email || !$pass1 || !$pass2 || !$accntype || !$country || !$state || !$city || !$zip ||
!$date || !$gender){
print "Please fill in all fields.";
exit;
}else {
//send all this info to another script that will handle this info and send an email
//to the user depending to its age or type.
}
?>