Functions: Corrected logic in valid_email().

This commit is contained in:
Nate Jones 2014-09-30 09:22:29 +00:00
parent 3d228815fc
commit 29c47d90a8
1 changed files with 3 additions and 3 deletions

View File

@ -976,11 +976,11 @@ function number_pad($number,$n) {
if(!function_exists('validate_email')) {
function valid_email($email) {
$regex = '/^[A-z0-9][\w.-]*@[A-z0-9][\w\-\.]+\.[A-z0-9]{2,6}$/';
if ($email != "" && preg_match($regex, $email) == 0) {
return false; // email address does not have valid syntax
if ($email != "" && preg_match($regex, $email) == 1) {
return true; // email address has valid syntax
}
else {
return true; // email address has valid syntax
return false; // email address does not have valid syntax
}
}
}