function checkEmail($email) { if(preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( \.[a-zA-Z0-9_-] +)+$/" , $email)){ list($username,$domain)=split('@',$email); if(!customCheckDnsrr($domain)){ return false; } return true; } return false; } function customCheckDnsrr($host,$recType='') { if(!empty($host)) { if($recType=='') $recType="MX"; exec("nslookup -type=$recType $host",$output); foreach($output as $line) { if(preg_match("/^$host/", $line)) { return true;} } return false; } return false; } /////// The php to check form // Check for email and verify // If empty input echo error if (empty ($_POST['email'])) { $email = FALSE; echo 'Please enter a email address!
'; } else { // Check to make sure its a valid email, and already exists if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email'])))) { $email = $_POST['email']; $check_email = "SELECT email FROM table WHERE email='$email'"; $result = mysql_query($check_email) or die (mysql_error()); // If username exists echo taken error if (mysql_num_rows($result) > 0) { $email = FALSE; echo 'That email is already being used!
'; } else { // Check to see if emails match if ($_POST['email'] == $_POST['email_verify']) { $email = trim($_POST['email']); if (!checkEmail($email)) { echo 'Invalid email address!
'; } else { $email = TRUE; $email = $_POST['email']; } } else { $email = FALSE; echo 'Your email address did not match!
';} } } else { // If email is not valid echo error $email = FALSE; echo 'That is not a valid email address!
';} } /// This all uses boolean true and fasle... to just continue do if ($email = TRUE) { echo 'Thank You'; } else { echo 'Please try again!
';}