Browse Source

php - add a list of disallowed pattents in username when registering

master
kanoi 9 years ago
parent
commit
63e4361898
  1. 13
      pool/page_reg.php

13
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);

Loading…
Cancel
Save