Changeset 18164 for trunk/include/functions.inc.php
- Timestamp:
- Sep 23, 2012, 11:34:30 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r17748 r18164 1726 1726 } 1727 1727 } 1728 1729 /** 1730 * check email format 1731 */ 1732 function email_check_format($mail_address) 1733 { 1734 if (version_compare(PHP_VERSION, '5.2.0') >= 0) 1735 { 1736 return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; 1737 } 1738 else 1739 { 1740 $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase 1741 $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 1742 $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 1743 1744 return (bool)preg_match($regex, $mail_address); 1745 } 1746 } 1728 1747 ?>
Note: See TracChangeset
for help on using the changeset viewer.