开发者

Testing user HTTP proxy using PHP script

Welcome,

I'm writing application what will allow me to try detect what type of HTTP proxy user have installed.

Script calling remote server adding parameter http://xxxx.php?my_ip=real_IP

Here is my application:

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


$real_ip=$_GET['my_ip'];


$ip1=$_SERVER['HTTP_X_FORWARDED_FOR'];
$ip2=$_SERVER['HTTP_X_FORWARDED'];
$ip3=$_SERVER['HTTP_FORWARDED_FOR'];
$ip4=$_SERVER['HTTP_CLIENT_IP'];
$ip5=$_SERVER['HTTP_VIA'];

$ip6=$_SERVER['REMOTE_ADDR'];

$ip_array[1]=$ip1;
$ip_array[2]=$ip2;
$ip_array[3]=$ip3;
$ip_arra开发者_运维知识库y[4]=$ip4;
$ip_array[5]=$ip5;


if($ip6==$real_ip)
{
  echo "You are not using proxy.";  
}
else
{

if(in_array($real_ip, $ip_array))
{
    echo "You are using transparent proxy with one releave your ip.";
}
else
{

    if( $_SERVER['HTTP_X_FORWARDED_FOR']
   || $_SERVER['HTTP_X_FORWARDED']
   || $_SERVER['HTTP_FORWARDED_FOR']
   || $_SERVER['HTTP_CLIENT_IP']
   || $_SERVER['HTTP_VIA'])
    {
    echo "You are using anonymous proxy with one protect Your IP but inform www servers about using proxy";    
    }
    else
    {
    echo "You are using elite proxy, with one hide your IP and don't inform www servers about using proxy";    
    }


}
}




$table=<<<table

<p>Ip  HTTP_X_FORWARDED_FOR FOR : $ip1</p>
<p>Ip  HTTP_X_FORWARDED  : $ip2</p>
<p>Ip  HTTP_FORWARDED_FOR FOR : $ip3</p>
<p>Ip  HTTP_CLIENT_IP FOR : $ip4</p>
<p>Ip  HTTP_VIA FOR : $ip5</p>
<p>Ip  remote addr  : $ip6</p>

table;
echo $table;

?>

I run some tests and application looks working very well.

If you have any tips please tell me.

I mean i would like know am i dont miss something important.

Regards


Another way in which some major players (Paypal, eBay, sites that have high security etc) find proxies is by looking up your IP's hostname with gethostbyaddr() which can reveal a source that is likely to be a proxy E.g. server.squid.com (Very obvious example to show you what I mean!)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜