validate email with filter_var

This commit is contained in:
NekoCH
2025-10-09 19:39:41 +08:00
parent 7b0b51cb7e
commit dfdf64833f
2 changed files with 2 additions and 2 deletions

View File

@@ -2316,7 +2316,7 @@ function validfilename($name) {
}
function validemail($email) {
return preg_match('/^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/is', $email);
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
function validlang($langid) {

View File

@@ -311,7 +311,7 @@ if (count($_GET) > 0 && !$_GET['h'])
if (strpos($email,'*') === False && strpos($email,'?') === False
&& strpos($email,'%') === False)
{
if (validemail($email) !== 1)
if (!validemail($email))
{
stdmsg("Error", "Bad email.");
stdfoot();