1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Code] Detect Proxy With Php

Discussion in 'Black Hat SEO' started by meannn, Aug 3, 2011.

  1. meannn

    meannn Supreme Member

    Joined:
    Apr 22, 2009
    Messages:
    1,461
    Likes Received:
    1,896
    Occupation:
    Unemployed Winner
    Location:
    TR
    You can detect if visitor(s) use proxy. And if they're not pro :p

    PHP:
    $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!");
    }


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

    Tertsim Newbie

    Joined:
    Dec 11, 2009
    Messages:
    35
    Likes Received:
    2
    Looks good, could someone confirm that the ports code does not create any false positives?
     
  3. kikou

    kikou Junior Member Premium Member

    Joined:
    Feb 23, 2008
    Messages:
    107
    Likes Received:
    66
    Thank you I will test it.