]> git.mxchange.org Git - mailer.git/commitdiff
Nickname login should work now
authorRoland Häder <roland@mxchange.org>
Mon, 17 Aug 2009 17:43:38 +0000 (17:43 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 17 Aug 2009 17:43:38 +0000 (17:43 +0000)
.htaccess
inc/libs/nickname_functions.php

index bea521ae53281c68408a2275f4c0fd0750a6ab9d..201c43da67aaec4ab6c995671653b210d93f9aeb 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,9 +1,9 @@
-Options -Indexes\r
-DirectoryIndex index.php\r
-\r
-<IfModule mod_rewrite.c>\r
-       RewriteEngine On\r
-       RewriteRule     ^cms/(.*)/wht/(.*)$             modules.php?module=$1&what=$2           [L]\r
-       RewriteRule     ^cms/(.*)/act/(.*)$             modules.php?module=$1&action=$2         [L]\r
-       RewriteRule     ^cms/(.*)$                              modules.php?module=$1                           [L]\r
-</IfModule>\r
+Options -Indexes
+DirectoryIndex index.php
+
+<IfModule mod_rewrite.c>
+       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]
+</IfModule>
index cb013cf8ab6416b49399106aa6aec796831f92fe..5de88e52ccf5f3de317c6c7d1c1d593076316c0d 100644 (file)
@@ -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 = '';