Blocking Proxy IP

Started on the old forum in July 2009 · view the original in the archive · old links redirect here

4 replies · 710 views · started 17 years ago · 1 min read

4 participants
anderson Developer · 146 posts #1

Hello, I need a code that can block proxy server from accessing my WAP site. I use this code:

if ($_SERVER['HTTP_X_FORWARDED_FOR']
   || $_SERVER['HTTP_X_FORWARDED']
   || $_SERVER['HTTP_FORWARDED_FOR']
   || $_SERVER['HTTP_CLIENT_IP']
   || $_SERVER['HTTP_VIA']
   || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
   || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))
{
    exit('Proxy detected');
}

but doesn't working. Anyone have working script please post here. Thanks.

Wait...

Anshul Senior · 296 posts #2

try getenv instead of server maybe it will work

if (getenv("HTTP_X_FORWARDED_FOR")) { proxy is detected }

subzero Super moderator Fellow · 3,954 posts #3
<?
IF(ISSET($_SERVER['HTTP_X_FORWARDED_FOR']) || ($_SERVER['HTTP_USER_AGENT']=='') || ($_SERVER['HTTP_VIA']!='')){
        DIE("Proxy servers not allowed.");
}
 
$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.");
        EXIT;
}
?>

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

anderson Developer · 146 posts #5

Anshul wrote: try getenv instead of server maybe it will work

if (getenv("HTTP_X_FORWARDED_FOR")) { proxy is detected }

No no no! Not working!!! I created a file named proxy.php like this

<?
if(getenv("HTTP_X_FORWARDED_FOR"))
{
print "proxy is detected";
}else
print "no proxy";
?>

in my general opera pc browser it outputs

no proxy

when I use a proxy it also outputs the same. Peoxy I used: ▶ ShadowSurf Free Anonymous Proxy

Now tell me my errors.

Wait...

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close