Opps, did forget the fetch :(
authorRoland Haeder <roland@mxchange.org>
Mon, 12 Aug 2013 18:45:59 +0000 (18:45 +0000)
committerRoland Haeder <roland@mxchange.org>
Mon, 12 Aug 2013 18:45:59 +0000 (18:45 +0000)
libs/lib_connect.php
libs/lib_updates.php

index 975ffc497b0b289a0445d549907f0a7011fa0ca8..8686ec54e490f9e1eacc70cc153c627fc0f4fa61 100644 (file)
@@ -311,8 +311,8 @@ function isCrackerTrackerIpSuspicious () {
                return FALSE;
        } // END - if
 
-       // We only need the very last attempt to get!
-       $result = runCrackerTrackerSql("SELECT SQL_SMALL_RESULT COUNT(`id`) AS `cnt` FROM `ctracker_data` USE INDEX (`remote_proxy_last`) WHERE `remote_addr`='" . determineCrackerTrackerRealRemoteAddress() . "' OR `proxy_addr`='" . getenv('REMOTE_ADDR') . "' LIMIT 1", __FUNCTION__, __LINE__);
+       // Check if an entry is there
+       $result = runCrackerTrackerSql("SELECT COUNT(`id`) AS `cnt` FROM `ctracker_data` USE INDEX (`remote_proxy_last`) WHERE `remote_addr`='" . determineCrackerTrackerRealRemoteAddress() . "' OR `proxy_addr`='" . getenv('REMOTE_ADDR') . "' LIMIT 1", __FUNCTION__, __LINE__);
 
        // Get row count
        list($rows) = mysql_fetch_row($result);
@@ -322,6 +322,9 @@ function isCrackerTrackerIpSuspicious () {
 
        // And again?
        if ($found === TRUE) {
+               // Yes, one is found, then load it
+               $result = runCrackerTrackerSql("SELECT SQL_SMALL_RESULT * FROM `ctracker_data` USE INDEX (`remote_proxy_last`) WHERE `remote_addr`='" . determineCrackerTrackerRealRemoteAddress() . "' OR `proxy_addr`='" . getenv('REMOTE_ADDR') . "' ORDER BY `last_attempt` DESC LIMIT 1", __FUNCTION__, __LINE__);
+
                // Cache the entry
                $GLOBALS['ctracker_last_suspicious_entry'] = mysql_fetch_array($result);
        } // END - if
index f844742ccb1d0a425d54123fb633480a38b6215b..a0ea51d2e79739891b530f92c6127b65e0d8e94d 100644 (file)
@@ -69,8 +69,8 @@ FOREIGN KEY ( `ctracker_data_id` ) REFERENCES `' . $GLOBALS['ctracker_dbname'] .
                ),
 
                // Better key for always repeating query
-               3 => array(
-                       'ALTER TABLE `ctracker`.`ctracker_data` ADD INDEX `remote_proxy_last` ( `remote_addr`, `proxy_addr` )',
+               4 => array(
+                       'ALTER TABLE `ctracker`.`ctracker_data` ADD INDEX `remote_proxy_last` ( `remote_addr`, `proxy_addr`, `last_attempt` DESC )',
                ),
        );
 }