透明代理,Transparent Proxies
REMOTE_ADDR = 代理服务器 IP
HTTP_VIA = 代理服务器 IP (补充:这个字段由代理服务器填充,有时会填充网关信息等)
HTTP_X_FORWARDED_FOR = 您的真实 IP
匿名代理,Anonymous Proxies
REMOTE_ADDR = 代理服务器 IP
HTTP_VIA = 代理服务器 IP (补充:这个字段由代理服务器填充,有时会填充网关信息等)
HTTP_X_FORWARDED_FOR = 代理服务器 IP
高匿名代理,High Anonymity Proxies/Elite Proxies
REMOTE_ADDR = 代理服务器 IP
HTTP_VIA = 没数值或不显示
HTTP_X_FORWARDED_FOR = 没数值或不显示
PHP检测客户端是否使用代理:
<?php
header("Content-type: text/html; charset=utf-8");
if(!empty($_SERVER['HTTP_VIA'])) //使用了代理
{
if(!isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
echo "Anonymous Proxies 普通匿名代理服务器";
//代理IP地址为 $_SERVER['REMOTE_ADDR']
}
else
{
echo "Transparent Proxies 透明代理服务器";
//代理IP地址为 $_SERVER['REMOTE_ADDR']
//真实ip地址为 $_SERVER['HTTP_X_FORWARDED_FOR']
}
}
else
{
echo "没有代理或者是高匿名代理";
//真实ip地址为 $_SERVER['REMOTE_ADDR']
}