]> git.mxchange.org Git - ctracker.git/commitdiff
Fixes for missing config if no database link is provided
authorRoland Haeder <roland@mxchange.org>
Sun, 18 Jul 2010 12:03:51 +0000 (12:03 +0000)
committerRoland Haeder <roland@mxchange.org>
Sun, 18 Jul 2010 12:03:51 +0000 (12:03 +0000)
libs/lib_connect.php

index 82e6fe0c87274281a0631dabb6b5a3e8db27ee9a..3b3a97f9ea8c1a4f1e91dc3d565f0ad065599e7c 100644 (file)
@@ -37,7 +37,18 @@ function aquireCrackerTrackerDatabaseLink () {
                        // Load the config
                        crackerTrackerLoadConfig();
                }
-       } // END - if
+       } else {
+               // Init fake config
+               crackerTrackerInitFakeConfig();
+       }
+}
+
+// Inits a fake configurtation
+function crackerTrackerInitFakeConfig () {
+       // Set the array
+       $GLOBALS['ctracker_config'] = array(
+               'ctracker_alert_user' => 'Y',
+       );
 }
 
 // Checks if the link is up
@@ -294,6 +305,12 @@ function getCrackerTrackerConfig ($entry) {
 
 // Did the current IP already generated blocked attempts?
 function isCrackerTrackerIpSuspicious () {
+       // Skip this silently if we have not config
+       if (!isCrackerTrackerDatabaseLinkUp()) {
+               // Skip this step silently, all is not suspicious
+               return false;
+       } // END - if
+
        // We only need the very last attempt to get!
        $result = runCrackerTrackerSql("SELECT * FROM `ctracker_data` WHERE `remote_addr`='" . determineCrackerTrackerRealRemoteAddress() . "' ORDER BY `last_attempt` DESC LIMIT 1", __FUNCTION__, __LINE__);