From be98136fc3daa9ded9116ed7232640a0384286d9 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sun, 18 Jul 2010 12:03:51 +0000 Subject: [PATCH] Fixes for missing config if no database link is provided --- libs/lib_connect.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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__); -- 2.39.5