Hi All,
I have seen similar solutions but modifying the code to fit my site is proving to be a problem. I would like to verify the domain of a user exists before he/she submits a form. I have created the function in a class file and call this class. However, the logic is rejecting all domains regardless of whether they exist or not.
my function code is as follows from my auth_class.php file.
function myCheckDNSRR($hostName, $recType = '')
{
if(!empty($hostName)) {
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;
$this->domchk = 1;
}
}
return false;
$this->domchk = 0;
}
return false;
$this->domchk = 0;
}
}
The code from the form page is as follows:
$auth = new authorise;
$auth->myCheckDNSRR($form['email']);
if ($auth->domchk == 0) {
$output->msg .= "Invalid domain. Please check and try again.<br />";
$mark['email']= 1;
}
I can't figure out what I'm doing wrong with the logic and I just need to be pointed in the right direction. Thanks all.