哦,这个不用写,这个是这样判断的
if (defined("CHECK_X_FORWARDED_FOR")) {
@$fullfromhost=$_SERVER["HTTP_X_FORWARDED_FOR"];
if ($fullfromhost=="") {
@$fullfromhost=$_SERVER["REMOTE_ADDR"];
$fromhost=$fullfromhost;
}
else {
$ips = explode(",", $fullfromhost);
$c = count($ips);
if ($c > 1) {
$fromhost = trim($ips[$c - 1]);
if (isset($proxyIPs) && in_array($fromhost, $proxyIPs)) {
$fromhost = $ips[$c - 2];
} // X-Forwarded-For 里要是没这么多一个就不用了
} else $fromhost = $fullfromhost;
}
}
【 在 fancyrabbit (fancy★岁月静好现世安稳) 的大作中提到: 】
: 哦,然后在下面写
: $proxyIPs = array("127.0.0.1"); // 你的 squid 相对于 webserver 的地址
--
FROM 123.116.113.*