X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fproxyscan.phh;h=8d78a6ab62599657272542e44e1e2c0dac2e2e43;hb=03002883141b5e751650f5a28812456c2aa5f054;hp=c458926b9fe4e37a5d68c5103a19eb05141102b8;hpb=0c0725455c4c965b8eafeb7dad0453b7cd0e4ac0;p=brisk.git diff --git a/web/Obj/proxyscan.phh b/web/Obj/proxyscan.phh index c458926..8d78a6a 100644 --- a/web/Obj/proxyscan.phh +++ b/web/Obj/proxyscan.phh @@ -54,6 +54,10 @@ class proxy_detector { ); } + /* + function exists_in_rbl($remote) + verify if an host is into a proxy black list or not + */ function exists_in_rbl($remote) { $rbls = array('http.dnsbl.sorbs.net', 'misc.dnsbl.sorbs.net'); // $remote = $_SERVER['REMOTE_ADDR']; @@ -125,19 +129,19 @@ class proxy_detector { /** - * BOOL $proxy = detect( VOID ) + * BOOL $proxy = detect( $addr ) * Start detection and return TRUE if a proxy server is detected... */ - function detect(){ + function detect($addr){ GLOBAL $G_proxy_white_list; $log = ""; foreach($G_proxy_white_list as $authproxy) { - if ($_SERVER['REMOTE_ADDR'] == $authproxy) + if ($addr == $authproxy) return (FALSE); } - if ($this->exists_in_rbl($_SERVER['REMOTE_ADDR']) == TRUE) + if ($this->exists_in_rbl($addr) == TRUE) return (TRUE); // //scan all headers @@ -149,11 +153,11 @@ class proxy_detector { //let's do something... if($log){ - $log = $this->lastLog = date("Y-m-d H:i:s")."\nDetected proxy server: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])." ({$_SERVER['REMOTE_ADDR']})\n".$log; + $log = $this->lastLog = date("Y-m-d H:i:s")."\nDetected proxy server: ".gethostbyaddr($addr)." ({$addr})\n".$log; //mail message if($this->getConfig('MAIL_ALERT_TO')) - mail($this->getConfig('MAIL_ALERT_TO'),"Proxy detected at {$_SERVER['REQUEST_URI']}",$log); + mail($this->getConfig('MAIL_ALERT_TO'),"Proxy detected at {$addr}",$log); //write to file $f = $this->getConfig('LOG_FILE'); @@ -177,15 +181,19 @@ class proxy_detector { } //init class -function is_proxy() +function is_proxy($addr) { + /* FIXME: test to verify reasons of poor multitasking performances */ + return (FALSE); + /* FIXME: end */ + $proxy = new proxy_detector(); //start detect - if($proxy->detect()) { + if($proxy->detect($addr)) { //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

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

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