diff options
author | ahriman <ahriman@falte.red> | 2019-05-04 04:01:07 +0000 |
---|---|---|
committer | ahriman <ahriman@falte.red> | 2019-05-04 04:01:07 +0000 |
commit | ab145d9522fc705e82c385ac1565c06fa41dc2e3 (patch) | |
tree | 265a532d3aa0e1da18901c5e5709d4b335643f0d /submit.php | |
parent | 70786ad8199e8f351bc43c73bb81206e431dff12 (diff) | |
download | site-ab145d9522fc705e82c385ac1565c06fa41dc2e3.tar.gz |
new user restriction function
Diffstat (limited to 'submit.php')
-rwxr-xr-x | submit.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/submit.php b/submit.php index d138cea..72c3e8c 100755 --- a/submit.php +++ b/submit.php @@ -26,6 +26,11 @@ if ($_SERVER["SERVER_NAME"] != "localhost") function isTaken($istaken) { return in_array($istaken, file("userlist", FILE_IGNORE_NEW_LINES)); } +function bannedUsers($name) { + return in_array($name, [ + 'campari', + ]); +} function forbidden_name($name) { return in_array($name, [ '0x0', @@ -94,7 +99,7 @@ if (isset($_REQUEST["username"]) && isset($_REQUEST["email"])) { $message .= "<li>username too long (32 character max)</li>"; if (!preg_match('/^[A-Za-z][A-Za-z0-9]{2,31}$/', $name)) $message .= "<li>username contains invalid characters (lowercase only, must start with a letter)</li>"; - if (isTaken($name) || forbidden_name($name)) + if (isTaken($name) || forbidden_name($name) || bannedUsers($name)) $message .= "<li>sorry, the username $name is unavailable</li>"; // Check the e-mail address. |