Make email check more general

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2023-08-26 03:28:07 -04:00
parent 94b2a3f5ac
commit e752fcca82
Signed by untrusted user: cobra
GPG Key ID: 4FD8F812083FF6F9
1 changed files with 8 additions and 4 deletions

View File

@ -26,17 +26,21 @@
return $str;
}
$err = $email = $code_err = '';
if (!empty($_GET['email'])) {
if (!empty($_GET['email']) && !empty($_GET['action'])) {
if (filter_var(sanitize($_GET['email']), FILTER_VALIDATE_EMAIL)) {
if (preg_match("/^" . preg_quote($_GET['email']) . "$/", file_get_contents("/var/spool/list")) === 1) {
$email = sanitize($_GET['email']);
if ($_GET['action'] == "sub")
$email = sanitize($_GET['email']);
else $err = "E-mail not in list";
} else {
$err = "E-mail already in use";
if ($_GET['action'] == "unsub")
$email = sanitize($_GET['email']);
else $err = "E-mail already in list";
}
} else {
$err = "Invalid E-mail";
}
} else if (!empty($_GET['action'])) {
} else {
$err = "E-mail is required";
}
if (empty($_GET['action']) || ($_GET['action'] != "sub" && $_GET['action'] != "unsub") || !empty($err)) {