Hi, I am trying to validate email address's on my registration form. Everything works great except for checkdnsrr function. I was wondering can anyone help with this. I never used checkdnsrr before.
Here is the code I'm using:
//set flag that sais pwd is OK
$pwdOK = true;
//trim whitespace
$_POST['pwd'] = trim($_POST['pwd']);
if (strlen($_POST['pwd']) < 3) {
$error['pwd_length'] = 'Password must be at least 3 charecters';
$pwdOK = false;
}
//validate email
if(!function_exists('checkdnsrr'))
{
function checkdnsrr($localhost, $recType = '')
{
if(!empty($localhost)) {
if( $recType == '' ) $recType = "MX";
exec("nslookup -type=$recType $hostName", $result);
// check each line to find the one that starts with the host
// name. If it exists then the function succeeded.
foreach ($result as $line) {
if(eregi("^$hostName",$line)) {
return true;
}
}
// otherwise there was no mail handler for the domain
return false;
}
return false;
}
}
Thanks.