mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user