X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Ffunctions.php;h=64e185bdec56a990499f7ae4018c482ea523da91;hb=116f17077ae6fa32c7373ccd6aaf94044bb6c276;hp=7262baf0b705d1fad031146fbf42b482dcdac4dc;hpb=81bfbcd72e424060ea1223b49ad92fcfa150f361;p=mailer.git diff --git a/inc/functions.php b/inc/functions.php index 7262baf0b7..64e185bdec 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1964,22 +1964,22 @@ function sendRawRequest ($host, $request) { } // Taken from www.php.net eregi() user comments -function VALIDATE_EMAIL ($email) { +function isEmailValid ($email) { // Compile email $email = COMPILE_CODE($email); // Check first part of email address - $first = "[-a-z0-9!#$%&\'*+/=?^_<{|}~]+(\.[-a-zA-Z0-9!#$%&\'*+/=?^_<{|}~]+)*"; + $first = '[-a-z0-9!#$%&\'*+/=?^_<{|}~]+(\.[-a-zA-Z0-9!#$%&\'*+/=?^_<{|}~]+)*'; // Check domain - $domain = "[a-z0-9-]+(\.[a-z0-9-]{2,5})+"; + $domain = '[a-z0-9-]+(\.[a-z0-9-]{2,5})+'; // Generate pattern - $regex = '^'.$first.'@'.$domain.'$'; + $regex = '@^' . $first . '\@' . $domain . '$@iU'; // Return check result - // @TODO eregi() should be rewritten here - return eregi($regex, $email); + // @NOTE altered the regex-pattern and added modificator i (match both upper and lower case letters) and U (PCRE_UNGREEDY) to work with preg_match the same way as eregi + return preg_match($regex, $email); } // Function taken from user comments on www.php.net / function eregi()