aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php99
1 files changed, 0 insertions, 99 deletions
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