English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The checkdnsrr() function performs DNS communication checks for the specified host (domain) or IP address
bool checkdnsrr ( string $host [, string $type = "MX" ] )
It checks the DNS records of the corresponding host or IP address.
Parameters | Description |
---|---|
host | Possible IP address or hostname of the host |
type | The type can be any of the following: A, MX, NS, SOA, PTR, CNAME, AAAA, A6, SRV, NAPTR, TXT or ANY. |
If the record can be found, it returns TRUE; if the DNS record cannot be found or an error occurs, it returns FALSE.
PHP 5.3.0 - This function can also be used on the Windows platform.
PHP 5.2.4 - Added TXT record type.
PHP 5.0.0 - Added AAAA record type.
Try the following example
<?php function validate_email($email) { $exp = "^[a-z\'0-9]+([._-][a-z\'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$"; if (eregi($exp, $email)) { if (checkdnsrr(array_pop(explode("@", $email)), "MX")) { return true; } else { return false; } } else { return false; } } ?>
The following code will check if the password is valid