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
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

Link to comment
Share on other sites

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");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.