]> git.mxchange.org Git - ctracker.git/blobdiff - libs/lib_connect.php
Added 'safe_mode' (php.ini setting).
[ctracker.git] / libs / lib_connect.php
index c0476d4ef4575f40c985c23fea96db5258b5311d..8686ec54e490f9e1eacc70cc153c627fc0f4fa61 100644 (file)
@@ -311,14 +311,20 @@ function isCrackerTrackerIpSuspicious () {
                return FALSE;
        } // END - if
 
-       // We only need the very last attempt to get!
-       $result = runCrackerTrackerSql("SELECT * FROM `ctracker_data` WHERE `remote_addr`='" . determineCrackerTrackerRealRemoteAddress() . "' OR `proxy_addr`='" . getenv('REMOTE_ADDR') . "' ORDER BY `last_attempt` DESC 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__);
 
-       // Do we have entries?
-       $found = (mysql_num_rows($result) == 1);
+       // Get row count
+       list($rows) = mysql_fetch_row($result);
+
+       // Is there one entry?
+       $found = ($rows > 0);
 
        // 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