diff options
author | Dries Buytaert <dries@buytaert.net> | 2000-06-10 18:58:41 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2000-06-10 18:58:41 +0000 |
commit | 9583c72c677ac6f57e57916cff03f46cc0dfc51d (patch) | |
tree | dfc812589988485d9c250306594b0735e3ed1e91 /account.php | |
parent | 9b99d319bd9d348e24b30d989c58ef1f78989c08 (diff) | |
download | brdo-9583c72c677ac6f57e57916cff03f46cc0dfc51d.tar.gz brdo-9583c72c677ac6f57e57916cff03f46cc0dfc51d.tar.bz2 |
* Implemented ban-capabilities, a first step towards an admin-friendly user
system:
- you can add and remove wild-carded e-mails from the banlist.
- you can add and remove wild-carded hostnames from the banlist.
- you can add and remove wild-carded usernames from the banlist.
- you can add and remove wild-carded profanity from the banlist.
- you can browse all bans according to their category: see ban.php.
Diffstat (limited to 'account.php')
-rw-r--r-- | account.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/account.php b/account.php index 6d2d4a259..c94b2d463 100644 --- a/account.php +++ b/account.php @@ -1,6 +1,7 @@ <? -include('config.inc'); -include('functions.inc'); +include "config.inc"; +include "functions.inc"; +include "database.inc"; function dbsave($dbase, $data, $id=0) { foreach ($data as $key=>$value) { @@ -60,12 +61,17 @@ function newUser($user = "", $error="") { $theme->footer(); } function validateUser($user) { + include "ban.class.php"; + ### Verify username and e-mail address: $user[userid] = trim($user[userid]); if (empty($user[email]) || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $user[email]))) $rval = "the specified e-mail address is not valid.<BR>"; if (empty($user[userid]) || (ereg("[^a-zA-Z0-9_-]", $user[userid]))) $rval = "the specified username '$new[userid]' is not valid.<BR>"; if (strlen($user[userid]) > 15) $rval = "the specified username is too long: it must be less than 15 characters."; - if (eregi("^((root)|(httpd)|(operator)|(admin)|(administrator)|(news)|(deamon)|(nobody)|(ftp))$", $user[userid])) $rval = "the specified username is reserved."; + + ### Check to see whether the username or e-mail address are banned: + if ($ban = ban_match($user[userid], $type[usernames])) $rval = "the specified username is banned for the following reason: <I>$ban->reason</I>."; + if ($ban = ban_match($user[email], $type[addresses])) $rval = "the specified e-mail address is banned for the following reason: <I>$ban->reason</I>."; ### Verify whether username and e-mail address are unique: dbconnect(); @@ -73,13 +79,10 @@ function validateUser($user) { if (mysql_num_rows(mysql_query("SELECT email FROM testusers WHERE LOWER(email)=LOWER('$user[email]')")) > 0) $rval = "the specified e-mail address is already registered."; return($rval); } - function makePassword($min_length=6) { mt_srand((double)microtime() * 1000000); - $words = array("foo","bar","guy","neo","geek","nerd","fish","hack","star","moon","hero","cola","girl","fish","java","boss"); - while(strlen($password) < $min_length) { - $password .= $words[mt_rand(0, count($words))]; - } + $words = array("foo","bar","guy","neo","tux","moo","sun","god","geek","nerd","fish","hack","star","mice","warp","moon","hero","cola","girl","fish","java","boss"); + while(strlen($password) < $min_length) $password .= $words[mt_rand(0, count($words))]; return $password; } |