3 * Proxy Detector v0.1 with brisk customizations
4 * copyrights by: Daantje Eeltink (me@daantje.nl)
5 * http://www.daantje.nl
7 * first build: Mon Sep 18 21:43:48 CEST 2006
8 * last build: Tue Sep 19 10:37:12 CEST 2006
11 * This class can detect if a visitor uses a proxy server by scanning the
12 * headers returned by the user client. When the user uses a proxy server,
13 * most of the proxy servers alter the header. The header is returned to
14 * PHP in the array $_SERVER.
17 * GPL v2 licence. (http://www.gnu.org/copyleft/gpl.txt)
20 class proxy_detector {
26 function proxy_detector(){
30 function exists_in_rbl($remote)
31 verify if an host is into a proxy black list or not
33 function exists_in_rbl($remote) {
34 $rbls = array('http.dnsbl.sorbs.net', 'misc.dnsbl.sorbs.net');
36 if (preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/",
38 foreach ($rbls as $rbl) {
39 $rblhost = $matches[4] . "." . $matches[3] . "." .
40 $matches[2] . "." . $matches[1] . "." . $rbl;
42 $resolved = gethostbyname($rblhost);
43 // echo "RBL ".$rblhost."<br>";
44 if ($resolved != $rblhost) {
53 * BOOL $proxy = detect( $addr )
54 * Start detection and return TRUE if a proxy server is detected...
56 function detect($addr){
57 GLOBAL $G_proxy_white_list;
59 foreach($G_proxy_white_list as $authproxy) {
60 if ($addr == $authproxy)
64 if ($this->exists_in_rbl($addr) == TRUE)
67 //nope, no proxy was logged...
73 function is_proxy($addr)
75 $proxy = new proxy_detector();
78 return ($proxy->detect($addr));