This worked before (with ereg) but now it constantly get 'your email / number is invalid' this is my php with my functions in it:
Code: Select all
<?php
function validate_telephone_number($tel, $formats)
{
$format = trim(preg_replace('/[^0-9]/', '#', $tel));
return (in_array($format, $formats)) ? true : false;
}
$formats = array('#####-######', '(#####)######',
'(#####) ######', '##### ######', '###########');
function check_email_address($to) {
if (!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}¦[0-9]{1,3})(\]?)$/', $to)) {
return false;
}
$email_array = explode("@", $to);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if
(!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}¦[0-9]{1,3})(\]?)$/',
$local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false;
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if
(!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}¦[0-9]{1,3})(\]?)$/',
$domain_array[$i])) {
return false;
}
}
}
return true;
}
?>Thanks,
Aravona.