Taken care of possible missing elements
authorRoland Haeder <roland@mxchange.org>
Sat, 29 Sep 2012 22:06:08 +0000 (22:06 +0000)
committerRoland Haeder <roland@mxchange.org>
Sat, 29 Sep 2012 22:06:08 +0000 (22:06 +0000)
ctracker.php
libs/lib_general.php

index db3407bda41e7327311169d6bd410c10600848b5..93e7de2bd5b03f83a3693c2b89ea7075d1a1c819 100644 (file)
@@ -47,13 +47,13 @@ crackerTrackerUpdateDatabaseScheme();
 // If it differs to original and the *whole* request string is not in whitelist
 // then block the attempt
 if (isCrackerTrackerWormDetected()) {
-       // Send the email, this must be the last line because it contains a die()
+       // Send the email, this must be the last line in this if() block because it contains a exit()
        sendCrackerTrackerMail();
 } // END - if
 
 // Suspicious POST data detected?
 if (isCrackerTrackerPostAttackDetected()) {
-       // Send the email, this must be the last line because it contains a die()
+       // Send the email, this must be the last line in this if() block because it contains a exit()
        sendCrackerTrackerPostMail();
 } // END - if
 
index abc177842cf068ddb12d3eb8fa647cf3e5cee961..46ef8386060f46135929bfde89ad531ed6827c06 100644 (file)
@@ -81,6 +81,9 @@ function isCrackerTrackerDebug () {
 
 // Determines the real remote address
 function determineCrackerTrackerRealRemoteAddress () {
+       // Initial value
+       $address = '0.0.0.0';
+
        // Is a proxy in use?
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                // Proxy was used
@@ -88,7 +91,7 @@ function determineCrackerTrackerRealRemoteAddress () {
        } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
                // Yet, another proxy
                $address = $_SERVER['HTTP_CLIENT_IP'];
-       } else {
+       } elseif (isset($_SERVER['REMOTE_ADDR'])) {
                // The regular address when no proxy was used
                $address = $_SERVER['REMOTE_ADDR'];
        }
@@ -129,18 +132,36 @@ function crackerTrackerUserAgent () {
 
 // Detects the script name
 function crackerTrackerScriptName () {
+       // Is it there?
+       if (!isset($_SERVER['SCRIPT_NAME'])) {
+               // Return NULL
+               return NULL;
+       } // END - if
+
        // Should always be there!
        return crackerTrackerSecureString($_SERVER['SCRIPT_NAME']);
 }
 
 // Detects the query string
 function crackerTrackerQueryString () {
+       // Is it there?
+       if (!isset($_SERVER['QUERY_STRING'])) {
+               // Return NULL
+               return NULL;
+       } // END - if
+
        // Should always be there!
        return crackerTrackerEscapeString($_SERVER['QUERY_STRING']);
 }
 
 // Detects the server's name
 function crackerTrackerServerName () {
+       // Is it there?
+       if (!isset($_SERVER['SERVER_NAME'])) {
+               // Return NULL
+               return NULL;
+       } // END - if
+
        // Should always be there!
        return crackerTrackerSecureString($_SERVER['SERVER_NAME']);
 }