diff msite.inc.php @ 605:f928b0a6e1af

Better validation for e-mail addresses.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 27 Oct 2014 14:29:56 +0200
parents ba84d8e35d6b
children 3d2b70fbeb78
line wrap: on
line diff
--- a/msite.inc.php	Mon Oct 27 11:34:32 2014 +0200
+++ b/msite.inc.php	Mon Oct 27 14:29:56 2014 +0200
@@ -312,7 +312,7 @@
     return FALSE;
   }
 
-  if (strlen($email) > 0 && (strpos($email, "@") === FALSE || strpos($email, ".") === FALSE))
+  if (strlen($email) > 0 && preg_match("/^[a-z0-9][a-z0-9\+\-\.\%_]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", $email) != 1)
   {
     stError("E-mail address not in proper format.");
     return FALSE;