绝地无双
"HTTP_" 开头的$_SERVER很容易伪造.服务段判断还是挺容易的. 其实下面这个代码也是判断是否使用proxy.<?php
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))
{
echo "we caught you";
} ?>结论:服务段最好只取$_SERVER['REMOTE_ADDR']