--- fenglin/lib/client_addr.inc.php 2005/03/12 08:01:18 1.6 +++ fenglin/lib/client_addr.inc.php 2010/01/07 01:28:59 1.9 @@ -13,9 +13,9 @@ function Client_Address($addr=null,$x_ad if ($x_addr == null && isset($_SERVER["HTTP_X_FORWARDED_FOR"])) $x_addr = $_SERVER["HTTP_X_FORWARDED_FOR"]; - foreach($proxy_ip as $ip) + foreach($proxy_ip as $tmp => $ip) { - if (ereg($ip[0],$addr)) + if (preg_match("/".$ip."/",$addr)) { if ($x_addr != null) { @@ -23,9 +23,9 @@ function Client_Address($addr=null,$x_ad for($i=count($client_addr)-1;$i>=0;$i--) { $proxy = false; - foreach($proxy_ip as $ip) + foreach($proxy_ip as $tmp => $ip) { - if (ereg($ip,$client_addr[$i])) + if (preg_match("/".$ip."/",$client_addr[$i])) $proxy = true; } if (!$proxy)