Jump to content

checking for proxy.


seany123

Recommended Posts

i dont want to allow people on my site if they are trying to enter via a proxy...

 

i have looked around and found a couple solutions.

 

1.

$proxy_headers = array(   
'HTTP_VIA',   
'HTTP_X_FORWARDED_FOR',   
'HTTP_FORWARDED_FOR',   
'HTTP_X_FORWARDED',   
'HTTP_FORWARDED',   
'HTTP_CLIENT_IP',   
'HTTP_FORWARDED_FOR_IP',   
'VIA',   
'X_FORWARDED_FOR',   
'FORWARDED_FOR',   
'X_FORWARDED',   
'FORWARDED',   
'CLIENT_IP',   
'FORWARDED_FOR_IP',   
'HTTP_PROXY_CONNECTION'   
        );
foreach($proxy_headers as $x){
if (isset($_SERVER[$x])) die("You are using a proxy!");
}

 

2.

$ports = array(8080,80,81,1080,6588,8000,3128,553,554,4480);
foreach($ports as $port) {
    if (@fsockopen($_SERVER['REMOTE_ADDR'], $port, $errno, $errstr, 30)) {
        die("You are using a proxy!");
    }
}

 

i know neither are sure ways to beat proxies but apparently they work...

 

my problem is i have tried both on my site and whenever i try access my site via proxy or not my site just loads.... and loads and loads and nothing else happens?

 

 

so does anyone have any fix to this? or a better way to detect proxies?

 

all help would be great.

Link to comment
https://forums.phpfreaks.com/topic/193377-checking-for-proxy/
Share on other sites

and finally after a long wait i got this message:

 

Gateway Time-out

 

The gateway did not receive a timely response from the upstream server or application.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Link to comment
https://forums.phpfreaks.com/topic/193377-checking-for-proxy/#findComment-1018125
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.