From fd629c7a9ff83de74635b403de31c42c65860ab1 Mon Sep 17 00:00:00 2001 From: James Atkinson Date: Tue, 4 Mar 2003 17:52:50 +0000 Subject: Tons of work on the UCP, see my topic in the development forum for more info on the bigger changes. Registration should still work, the basic layout of the UCP is also done with the start on the profile settings area. git-svn-id: file:///svn/phpbb/trunk@3591 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 99 -------------------------------------------- 1 file changed, 99 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cb8da7e8c0..5123ab78c7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -799,105 +799,6 @@ function redirect($url) exit; } -// Check to see if the username has been taken, or if it is disallowed. -// Also checks if it includes the " character, which we don't allow in usernames. -// Used for registering, changing names, and posting anonymously with a username -function validate_username($username) -{ - global $db, $user; - - $username = $db->sql_escape($username); - - $sql = "SELECT username - FROM " . USERS_TABLE . " - WHERE LOWER(username) = '" . strtolower($username) . "'"; - $result = $db->sql_query($sql); - - if (($row = $db->sql_fetchrow($result)) && $row['username'] != $user->data['username']) - { - return $user->lang['Username_taken']; - } - - $sql = "SELECT group_name - FROM " . GROUPS_TABLE . " - WHERE LOWER(group_name) = '" . strtolower($username) . "'"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - return $user->lang['Username_taken']; - } - - $sql = "SELECT disallow_username - FROM " . DISALLOW_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['disallow_username'], '#')) . ')\b#i', $username)) - { - return $user->lang['Username_disallowed']; - } - } - - $sql = "SELECT word - FROM " . WORDS_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['word'], '#')) . ')\b#i', $username)) - { - return $user->lang['Username_disallowed']; - } - } - - // Don't allow " in username. - if (strstr($username, '"')) - { - return $user->lang['Username_invalid']; - } - - return false; -} - -// Check to see if email address is banned or already present in the DB -function validate_email($email) -{ - global $db, $user; - - if ($email != '') - { - if (preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email)) - { - $sql = "SELECT ban_email - FROM " . BANLIST_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if (preg_match('#^' . str_replace('*', '.*?', $row['ban_email']) . '$#is', $email)) - { - return $user->lang['Email_banned']; - } - } - - $sql = "SELECT user_email - FROM " . USERS_TABLE . " - WHERE user_email = '" . $db->sql_escape($email) . "'"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - return $user->lang['Email_taken']; - } - - return false; - } - } - - return $user->lang['Email_invalid']; -} // Does supplementary validation of optional profile fields. This // expects common stuff like trim() and strip_tags() to have already -- cgit v1.2.1