Jump to content

checkdnsrr always checks true?


nevesgodnroc

Recommended Posts

one of my clients has just recently started getting spam emails through his contact form that i put on his website. the attacker using very obviously bad domain for email address. and my checkdnsrr function always returns true.

 

I have hosted this site for about two years now and this just started happening in the last few months.

Link to comment
https://forums.phpfreaks.com/topic/126971-checkdnsrr-always-checks-true/
Share on other sites

no i am not sure whether they are using the form but i will look into header injection right away.

 

do you have any idea why the checkdnsrr function would always returrn true?

 


if(eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,6}$", stripslashes(trim($email)))){
$test = 0;
}else{  
$test = 1;
}// endif

if ($test == 0){
list($userName, $mailDomain) = split("@", $email); 					
   
  if (!checkdnsrr($mailDomain, "MX")) { 
    echo ("<br><h1>email address appears to be invalid!</h1><br>");
    return false;
  }else { 
    return true;

  } // end if

}else{ //test must = 1 (contains bad character)
echo ("<br><h1>email address appears to be invalid!</h1><br>");
return false;
}//end if $test==0 clause

 

hope you can see something.

Thanks

I don't know about the checkdnsrr function but one thing that I would consider is putting a captcha on the form.  Are you calling the function with the entire email address or are you doing something like this:

<?
list($user, $host) = explode("@", $_POST['email']);
$hostvalid = checkdnsrr($host, "MX");
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.