Forum Moderators: coopster
NOTE: It uses getmxrr()
check the manual [us2.php.net]
<<<
// ************ EMAIL
$email=htmlentities($_POST['email']);
if (empty($email))
{
echo"<h3>The email field is empty!</h3><p>
<a href='../register.php'><b>Please try again</b></a>";
exit();
}
if (isset ($email) &&!empty ($email) )
{ // ends end of script
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
if (!eregi($regexp, $email))
{
echo "The email should ONLY contain Alphanumerical Characters! (Alphabetical and numeric) And: @ and - or_ <br>
<b>You entered: $email</b><br>
<a href='../register.php'><b>Please try again</b></a>";
Exit();
}
else
{
include "../validate_email.php";
}
if ( validate_email($email))
{
echo"OK";
}
else
{
echo"Not OK";
}
}// ends above commented braket
// keep the function wherever you want and include it as shown above
// *********** End email
<?
function validate_email($email)
{
// Create the syntactical validation regular expression
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
// Presume that the email is invalid
$valid = 0;
// Validate the syntax
if (eregi($regexp, $email))
{
list($username,$domaintld) = split("@",$email);
// Validate the domain
//if (getmxrr($domaintld,$mxrecords))
$valid = 1;
} else {
$valid = 0;
}
return $valid;
}
?>
>>>