浏览代码

Functions: Corrected logic in valid_email().

Nate Jones 11 年之前
父节点
当前提交
99457eba7e
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      resources/functions.php

+ 3 - 3
resources/functions.php

@@ -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) {
-				return false; // email address does not have valid syntax
+			if ($email != "" && preg_match($regex, $email) == 1) {
+				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
 			}
 			}
 		}
 		}
 	}
 	}