From 1ac582c093b0aef55d8f300217d5a47bc2b7990b Mon Sep 17 00:00:00 2001
From: Roland Haeder <roland@mxchange.org>
Date: Tue, 26 Feb 2013 21:46:56 +0000
Subject: [PATCH] unsetCtrackerData() introduced

---
 libs/lib_connect.php |  8 ++++----
 libs/lib_general.php | 30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/libs/lib_connect.php b/libs/lib_connect.php
index 3a0b4b3..b981c03 100644
--- a/libs/lib_connect.php
+++ b/libs/lib_connect.php
@@ -77,16 +77,16 @@ function crackerTrackerCloseDatabaseLink () {
 	if (isCrackerTrackerDatabaseLinkUp()) {
 		// Did it work?
 		if (!mysql_close($GLOBALS['ctracker_link'])) {
-			// Remove the link from global array
-			unset($GLOBALS['ctracker_link']);
+			// Remove all data from global space
+			unsetCtrackerData();
 
 			// Attempt has failed
 			crackerTrackerDatabaseError(__FUNCTION__, __LINE__);
 		} // END - if
 	} // END - if
 
-	// Remove the link from global array
-	unset($GLOBALS['ctracker_link']);
+	// Remove all data from global space
+	unsetCtrackerData();
 }
 
 // Inserts given array, if IP/check_worm combination was not found
diff --git a/libs/lib_general.php b/libs/lib_general.php
index 46ef838..e2d0005 100644
--- a/libs/lib_general.php
+++ b/libs/lib_general.php
@@ -446,6 +446,9 @@ function crackerTrackerRedirectSameUrl () {
  * @access  private
  */
 function crackerTrackerSendRawRedirect ($url) {
+	// Better remove any data by ctracker
+	unsetCtrackerData();
+
 	// always close the session
 	session_write_close();
 
@@ -466,5 +469,32 @@ function crackerTrackerSendRawRedirect ($url) {
 	exit();
 }
 
+// Removes all ctracker-related data from global space
+function unsetCtrackerData () {
+	// Unset all
+	foreach (array(
+			'ctracker_host',
+			'ctracker_dbname',
+			'ctracker_user',
+			'ctracker_password',
+			'ctracker_debug_enabled',
+			'ctracker_email',
+			'ctracker_whitelist',
+			'ctracker_get_blacklist',
+			'ctracker_post_blacklist',
+			'ctracker_header',
+			'ctracker_post_track',
+			'ctracker_checkworm',
+			'ctracker_check_post',
+			'ctracker_last_sql',
+			'ctracker_last_result',
+			'ctracker_config',
+			'ctracker_updates',
+		) as $key) {
+			// Unset it
+			unset($GLOBALS[$key]);
+	} // END - foreach
+}
+
 // [EOF]
 ?>
-- 
2.39.5