From 63e436189870aad4f80ff61f4f46222d0bb114bb Mon Sep 17 00:00:00 2001 From: kanoi Date: Sun, 3 Jan 2016 14:52:58 +1100 Subject: [PATCH] php - add a list of disallowed pattents in username when registering --- pool/page_reg.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pool/page_reg.php b/pool/page_reg.php index 1b84b0da..5a9c87e6 100644 --- a/pool/page_reg.php +++ b/pool/page_reg.php @@ -111,6 +111,8 @@ function doreg2($data) # function try_reg($info, $page, $menu, $name, $u) { + $disallow = array('/kano/i', '/pool/i', '/kolivas/i'); + $user = getparam('user', false); $mail = trim(getparam('mail', false)); $pass = getparam('pass', false); @@ -160,6 +162,17 @@ function try_reg($info, $page, $menu, $name, $u) } } + if ($ok === true) + { + foreach ($disallow as $patt) + if (preg_match($patt, $user) === 1) + { + $ok = false; + $data['error'] = 'Disallowed username'; + break; + } + } + if ($ok === true) { $ans = userReg($user, $mail, $pass);