This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Checking email against DNS MX record
Started 14 years ago by vern1271 | 4 posts |
-
I'm trying to add DNS MX validation and I must be missing something, because I can't get it to work...
In the common-validator.php file after line 28, I added the following...
//validate DNS MX record
function domain_exists($value) {list($user,$domain) = split('@',$value);
if (!checkdnsrr($domain,'MX')) {
return 'Sorry, This domain is not valid';
} else {
return true;
}}
And in my post-functions.php file I added the following after $rules[$element_name]['email'] = true; on line 296 since I only want to do this on certain forms:
if ($form_id == '3') {
$rules[$element_name]['domain_exists'] = true;
}Any help would be appreciated.
Posted 14 years ago # -
Try changing your function to become like this:
function domain_exists($value) { $value = $value[0]; list($user,$domain) = split('@',$value); if (!checkdnsrr($domain,'MX')) { return 'Sorry, This domain is not valid'; } else { return true; } }
`
MachForm Founder
Posted 14 years ago # -
No luck... Anyone else ever implement this and get it working?
Posted 14 years ago # -
Hmm.. have you checked if the function checkdnsrr($domain,'MX') already worked fine on your site?
If you are using Windows server, this function only available since PHP 5.3.0
MachForm Founder
Posted 14 years ago #
Reply
You must log in to post.