crazymonster
Junior Member
- Apr 8, 2011
- 167
- 30
How to protect my php site from proxies (unreal visits).
What is the most effective method? And exampe code please!
What is the most effective method? And exampe code please!
$proxy_headers = array(
[COLOR=#800000]'HTTP_VIA'[/COLOR],
[COLOR=#800000]'HTTP_X_FORWARDED_FOR'[/COLOR],
[COLOR=#800000]'HTTP_FORWARDED_FOR'[/COLOR],
[COLOR=#800000]'HTTP_X_FORWARDED'[/COLOR],
[COLOR=#800000]'HTTP_FORWARDED'[/COLOR],
[COLOR=#800000]'HTTP_CLIENT_IP'[/COLOR],
[COLOR=#800000]'HTTP_FORWARDED_FOR_IP'[/COLOR],
[COLOR=#800000]'VIA'[/COLOR],
[COLOR=#800000]'X_FORWARDED_FOR'[/COLOR],
[COLOR=#800000]'FORWARDED_FOR'[/COLOR],
[COLOR=#800000]'X_FORWARDED'[/COLOR],
[COLOR=#800000]'FORWARDED'[/COLOR],
[COLOR=#800000]'CLIENT_IP'[/COLOR],
[COLOR=#800000]'FORWARDED_FOR_IP'[/COLOR],
[COLOR=#800000]'HTTP_PROXY_CONNECTION'[/COLOR]
);
[COLOR=#00008B]foreach[/COLOR]($proxy_headers [COLOR=#00008B]as[/COLOR] $x){
[COLOR=#00008B]if[/COLOR] (isset($_SERVER[$x])) [COLOR=#00008B]die[/COLOR]([COLOR=#800000]"You are using a proxy!"[/COLOR]);
}
[/FONT]
$ports = array([COLOR=#800000]8080[/COLOR],[COLOR=#800000]80[/COLOR],[COLOR=#800000]81[/COLOR],[COLOR=#800000]1080[/COLOR],[COLOR=#800000]6588[/COLOR],[COLOR=#800000]8000[/COLOR],[COLOR=#800000]3128[/COLOR],[COLOR=#800000]553[/COLOR],[COLOR=#800000]554[/COLOR],[COLOR=#800000]4480[/COLOR]);
[COLOR=#00008B]foreach[/COLOR]($ports [COLOR=#00008B]as[/COLOR] $port) {
[COLOR=#00008B]if[/COLOR] ([COLOR=#800000]@fsockopen[/COLOR]($_SERVER[[COLOR=#800000]'REMOTE_ADDR'[/COLOR]], $port, $errno, $errstr, [COLOR=#800000]30[/COLOR])) {
[COLOR=#00008B]die[/COLOR]([COLOR=#800000]"You are using a proxy!"[/COLOR]);
}
}
I prefer first method + list of public proxies
List of public proxies? Are you kidding me? There are hundred thousand public proxies lol.