From: Roland Haeder Date: Sun, 18 Jul 2010 12:03:51 +0000 (+0000) Subject: Fixes for missing config if no database link is provided X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6336abe6767fe5df58a4fb1f3373e6319886ee73;p=ctracker.git Fixes for missing config if no database link is provided --- diff --git a/libs/lib_connect.php b/libs/lib_connect.php index 82e6fe0..3b3a97f 100644 --- a/libs/lib_connect.php +++ b/libs/lib_connect.php @@ -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__);