From 296dab846261146e70b46907ee23dcadda0f9cff Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sun, 30 Mar 2008 11:17:06 +0000 Subject: [PATCH] white-list for proxy access added --- web/Obj/proxyscan.phh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/web/Obj/proxyscan.phh b/web/Obj/proxyscan.phh index d809e6f..e408706 100644 --- a/web/Obj/proxyscan.phh +++ b/web/Obj/proxyscan.phh @@ -69,11 +69,11 @@ class proxy_detector { $resolved = gethostbyname($rblhost); // echo "RBL ".$rblhost."
"; if ($resolved != $rblhost) { - return true; + return TRUE; } } } - return false; + return FALSE; } /** @@ -126,21 +126,26 @@ class proxy_detector { /** * BOOL $proxy = detect( VOID ) - * Start detection and return true if a proxy server is detected... + * Start detection and return TRUE if a proxy server is detected... */ function detect(){ + GLOBAL $G_proxy_white_list; $log = ""; + foreach($G_proxy_white_list as $authproxy) { + if ($_SERVER['REMOTE_ADDR'] == $authproxy) + return (TRUE); + } if ($this->exists_in_rbl($_SERVER['REMOTE_ADDR']) == TRUE) return (TRUE); - //scan all headers - foreach($this->scan_headers as $i){ - //proxy detected? lets log... - if($_SERVER[$i]) - $log.= "trigger $i: ".$_SERVER[$i]."\n"; - } +// //scan all headers +// foreach($this->scan_headers as $i){ +// //proxy detected? lets log... +// if($_SERVER[$i]) +// $log.= "trigger $i: ".$_SERVER[$i]."\n"; +// } //let's do something... if($log){ @@ -163,11 +168,11 @@ class proxy_detector { } //done - return true; + return TRUE; } //nope, no proxy was logged... - return false; + return FALSE; } } @@ -178,9 +183,9 @@ function is_proxy() //start detect if($proxy->detect()) { - //returned true, lets die... - echo "

Proxy detected



"; - echo "Please disable your proxy server in your browser preferences or internet settings, and try again.

"; + //returned TRUE, lets die... + echo "

Accesso attaverso proxy non consentito.



"; + echo "Se state utilizzando un proxy privato e volete che sia autorizzato mandate il suo indirizzo IP (".$_SERVER['REMOTE_ADDR'].") e il suo proprietario all'indirizzo di posta elettronica brisk@alternativeoutput.it

"; //parse logged info echo nl2br($proxy->getLog()); -- 2.17.1