Ad Space
Ad Space

Checking Email



In this example $_GET['cntnt01fbrp__39'] is an ajax call from formbuilder... You would/could change the get to email or something. This also suggest some valid alternates... ie: if you are not using an email for the user name then you would want to give the alternates...

 global $gCms; $FEU = $gCms->modules['FrontEndUsers']['object']; // A FUNCTION TO TEST FOR A VALID EMAIL ADDRESS, RETURN TRUE OR FALSE function check_valid_email($email){ // IS THE PATTERN OF THE EMAIL ADDRESS OK? if (!preg_match('/^[A-Z0-9_-][A-Z0-9._-]*@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,6}$/i', $email)) return FALSE; // IS THE DOMAIN OF THE EMAIL ADDRESS ROUTABLE OVER THE INTERNET FOR MX OR A RECORDS? $emaila = explode('@', $email); if ( checkdnsrr($emaila[1],"MX") || checkdnsrr($emaila[1],"A") ) return TRUE; // NOT ROUTABLE return FALSE; } if (!empty($_GET['cntnt01fbrp__39'])){ $e = $_GET['cntnt01fbrp__39']; if (check_valid_email($e)){ echo "<br/>VALID: $e \n"; if($FEU->GetUserID($e)){ $e1=$e; while ($FEU->GetUserID($e1)) { $e1=$e.rand(5, 100); } $e2=$e.rand(5, 100); while ($FEU->GetUserID($e2)) { $e2=$e.rand(5, 100); } echo '<span style="color:red">This is not available</span> <span style="color:green">'.$e1.' and '.$e2.' is available</span>'; return 'false'; }else{ echo "<br/>AVAILABLE: $e \n"; return 'true'; } }else{ echo "<br/>BOGUS: $e \n"; return 'false'; } } 
Previous page: SimpleBooking Next page: headerRoto