From a4934d0e25187257340a4946b6f545b3c54e254f Mon Sep 17 00:00:00 2001 From: the_systech Date: Thu, 3 Jan 2002 15:09:22 +0000 Subject: [PATCH] Updated validate_username function for use with mysql4 Bug #497077 git-svn-id: file:///svn/phpbb/trunk@1783 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index eb8b6cd15e..cd6bf26fca 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -526,6 +526,31 @@ function validate_username($username) } } break; + case 'mysql4': + $sql_users = "SELECT u.username, g.group_name + FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug + WHERE ug.user_id = u.user_id + AND g.group_id = ug.group_id + AND ( LOWER(u.username) = '" . strtolower(str_replace("\'", "''", $username)) . "' + OR LOWER(g.group_name) = '" . strtolower(str_replace("\'", "''", $username)) . "' )"; + $sql_disallow = "SELECT disallow_username + FROM " . DISALLOW_TABLE . " + WHERE '" . str_replace("\'", "''", $username) . "' LIKE disallow_username"; + if($result = $db->sql_query($sql_users)) + { + if($db->sql_numrows($result) > 0) + { + return(FALSE); + } + } + if($result = $db->sql_query($sql_disallow)) + { + if($db->sql_numrows($result) > 0) + { + return(FALSE); + } + } + break; default: $sql = "SELECT u.username, g.group_name