--- fenglin/lib/client_addr.inc.php 2004/06/10 11:27:10 1.1 +++ fenglin/lib/client_addr.inc.php 2010/01/07 01:28:59 1.9 @@ -1,11 +1,46 @@ $ip) + { + if (preg_match("/".$ip."/",$addr)) + { + if ($x_addr != null) + { + $client_addr = explode(",",$x_addr); + for($i=count($client_addr)-1;$i>=0;$i--) + { + $proxy = false; + foreach($proxy_ip as $tmp => $ip) + { + if (preg_match("/".$ip."/",$client_addr[$i])) + $proxy = true; + } + if (!$proxy) + return trim($client_addr[$i]); + } + return trim($client_addr[0]); + } + else + { + return $_SERVER["REMOTE_ADDR"]; + } + } + } + + return $_SERVER["REMOTE_ADDR"]; } ?>