Functions: Corrected logic in valid_email().
This commit is contained in:
parent
3d228815fc
commit
29c47d90a8
|
|
@ -976,11 +976,11 @@ function number_pad($number,$n) {
|
||||||
if(!function_exists('validate_email')) {
|
if(!function_exists('validate_email')) {
|
||||||
function valid_email($email) {
|
function valid_email($email) {
|
||||||
$regex = '/^[A-z0-9][\w.-]*@[A-z0-9][\w\-\.]+\.[A-z0-9]{2,6}$/';
|
$regex = '/^[A-z0-9][\w.-]*@[A-z0-9][\w\-\.]+\.[A-z0-9]{2,6}$/';
|
||||||
if ($email != "" && preg_match($regex, $email) == 0) {
|
if ($email != "" && preg_match($regex, $email) == 1) {
|
||||||
return false; // email address does not have valid syntax
|
return true; // email address has valid syntax
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return true; // email address has valid syntax
|
return false; // email address does not have valid syntax
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue