aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2008-09-07 11:05:15 +0000
committernikrou <nikrou@piwigo.org>2008-09-07 11:05:15 +0000
commitfae1a631244895abc6cc409d8d7f5aac9a140565 (patch)
tree4fa4ed1dcc0ee6571f5edcf5c10babecc628fbeb /include
parent157695d7b1e7e034924dfac0c665b07c1861b144 (diff)
fix too strict regex for email
git-svn-id: http://piwigo.org/svn/trunk@2507 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_user.inc.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index f60a7fe77..6276d37a0 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -41,7 +41,10 @@ function validate_mail_address($user_id, $mail_address)
return '';
}
- $regex = '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*\.[a-z]+$/';
+ $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase
+ $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name
+ $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i';
+
if ( !preg_match( $regex, $mail_address ) )
{
return l10n('reg_err_mail_address');