Forum Moderators: coopster
<b>Parse error</b>: parse error, unexpected T_ELSE in <b>
It also said that checkdnsrr is not in this php build... i am using local host and local server...
checkdnsrr() is not supported in this PHP build in ....
<?
if (!isset($_POST['submitted'])){$submitted = '';}else{$submitted = $_POST['submitted'];} // SUBMITTED
if (!isset($_POST['pattern'])){$pattern = '';}else{$pattern = $_POST['pattern'];} // pattern
if (!isset($_POST['parts'])){$parts = '';}else{$parts = $_POST['parts'];} // parts
?>
<?php
function check_email($mail_address) {
$pattern = "/^[\w-]+(\.[\w-]+)*@";
$pattern .= "([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i";
if (preg_match($pattern, $mail_address)) {
$parts = explode("@", $mail_address);
if (checkdnsrr($parts[1], "")){
echo "The e-mail address is valid.";
// return true;
} else {
echo "The e-mail host is not valid.";
// return false;
}
} else {
echo "The e-mail address contains invalid charcters.";
// return false;
}
}
check_email("INFO@example.co.uk");
?>
[edited by: coopster at 1:47 pm (utc) on June 17, 2005]
[edit reason] removed unnecessary html [/edit]
You aren't running this on a windows server, are you?
Note: This function is not implemented on Windows platforms. Try the PEAR class Net_DNS.Resource:
[php.net...]