From 225a4ff8e77443aa358bec092532f37a381f622a Mon Sep 17 00:00:00 2001 From: James Atkinson Date: Sun, 3 Feb 2002 19:19:42 +0000 Subject: [PATCH] Fixed bug #507473 git-svn-id: file:///svn/phpbb/trunk@2049 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f9506dafd4..48cddc3ff1 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -497,7 +497,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add // function validate_username($username) { - global $db, $lang; + global $db, $lang, $userdata; $sql = "SELECT u.username, g.group_name FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug @@ -507,9 +507,23 @@ function validate_username($username) OR LOWER(g.group_name) = '" . strtolower(str_replace("\'", "''", $username)) . "' )"; if ( $result = $db->sql_query($sql) ) { - if ( $db->sql_fetchrow($result) ) + if ( $row = $db->sql_fetchrow($result) ) { - return array('error' => $lang['Username_taken']); + if($userdata['session_logged_in']) + { + if($row['username'] != $userdata['username']) + { + return array('error' => $lang['Username_taken']); + } + else + { + return array('error' => ''); + } + } + else + { + return array('error' => $lang['Username_taken']); + } } }