Network functions problem
| From: | Papagelis Athanasios | Date: | Tue, 17 Oct 2000 13:58:40 +0000 |
| Subject: | Network functions problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3293@lists.php.net to get a copy of this message | ||
hello to all,
I'm using windows 2000 with php 4.0.3 and I have found an email validator
for an e-commerce site we are preparing. (see below)
The problem is that the checkdnsrr function doesn't work at all. Anyone
knows why or any way around this problem ....???
Thanks in advance.
S
function checkEmail($email, $check_dns = false)
{
if(
(preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email))
||
(preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/'
, $email))
)
{
if($check_dns)
{
$host = explode('@', $email);
// Check for MX record
if( checkdnsrr($host[1], 'MX') ) return true;
// Check for A record
if( checkdnsrr($host[1], 'A') ) return true;
// Check for CNAME record
if( checkdnsrr($host[1], 'CNAME') ) return true;
}
else
{
return true;
}
}
return false;
}