--- fenglin/lib/client_addr.inc.php 2005/03/23 17:31:14 1.8 +++ fenglin/lib/client_addr.inc.php 2025/04/29 11:55:32 1.13 @@ -1,46 +1,9 @@ - $ip) + function client_addr(int $mask_level = 0) : string { - if (ereg($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 (ereg($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"]; -} + $ip = (isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : ""); -?> + return ip_mask($ip, $mask_level, "%"); + }