From e9d9b430aa90c0519671702ce9fe13fc497451d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 17 Aug 2009 17:43:38 +0000 Subject: [PATCH] Nickname login should work now --- .htaccess | 18 +++++++++--------- inc/libs/nickname_functions.php | 21 +++++++++++++++------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.htaccess b/.htaccess index bea521ae53..201c43da67 100644 --- a/.htaccess +++ b/.htaccess @@ -1,9 +1,9 @@ -Options -Indexes -DirectoryIndex index.php - - - RewriteEngine On - RewriteRule ^cms/(.*)/wht/(.*)$ modules.php?module=$1&what=$2 [L] - RewriteRule ^cms/(.*)/act/(.*)$ modules.php?module=$1&action=$2 [L] - RewriteRule ^cms/(.*)$ modules.php?module=$1 [L] - +Options -Indexes +DirectoryIndex index.php + + + RewriteEngine On + RewriteRule ^cms/(.*)/wht/(.*)$ modules.php?module=$1&what=$2 [L] + RewriteRule ^cms/(.*)/act/(.*)$ modules.php?module=$1&action=$2 [L] + RewriteRule ^cms/(.*)$ modules.php?module=$1 [L] + diff --git a/inc/libs/nickname_functions.php b/inc/libs/nickname_functions.php index cb013cf8ab..5de88e52cc 100644 --- a/inc/libs/nickname_functions.php +++ b/inc/libs/nickname_functions.php @@ -42,7 +42,7 @@ if (!defined('__SECURITY')) { require($INC); } -// +// Checks wether the nickname is active function NICKNAME_IS_ACTIVE ($uidNick) { // By default nothing is found... $ret = false; @@ -55,10 +55,19 @@ function NICKNAME_IS_ACTIVE ($uidNick) { // Increment cache counter incrementConfigEntry('cache_hits'); } else { - // Search in database - // @TODO Can we replace this with GET_TOTAL_DATA() ? - $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s OR nickname='%s' LIMIT 1", - array(bigintval($uidNick), $uidNick), __FUNCTION__, __LINE__); + // Init result + $result = false; + + // Nickname or userid used? + if (($uidNick + 0) == $uidNick) { + // Userid given + $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid` =%s LIMIT 1", + array(bigintval($uidNick)), __FUNCTION__, __LINE__); + } else { + // Nickname given + $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1", + array($uidNick), __FUNCTION__, __LINE__); + } // Check existence of nickname $ret = (SQL_NUMROWS($result) == 1); @@ -74,7 +83,7 @@ function NICKNAME_IS_ACTIVE ($uidNick) { return $ret; } -// +// "Getter" for nickname for specfied userid function NICKNAME_GET_NICK ($userid) { // If not found... $ret = ''; -- 2.39.5