/[LeafOK_CVS]/fenglin/lib/client_addr.inc.php
ViewVC logotype

Diff of /fenglin/lib/client_addr.inc.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 by sysadm, Sun Mar 2 02:32:22 2025 UTC Revision 1.11 by sysadm, Fri Mar 28 05:51:38 2025 UTC
# Line 1  Line 1 
1  <?  <?
2  require_once "common.inc.php";          require_once "../lib/ip_mask.inc.php";
3    ?>
4  function Client_Address($addr=null,$x_addr=null)  <?
5    function client_addr(int $mask_level = 0) : string
6  {  {
7          if ($addr == null)          $ip = (isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : "");
                 $addr = $_SERVER["REMOTE_ADDR"];  
8    
9          if ($x_addr == null && isset($_SERVER["HTTP_X_FORWARDED_FOR"]))          return ip_mask($ip, $mask_level, "%");
                 $x_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];  
   
         return $_SERVER["REMOTE_ADDR"];  
10  }  }
   
11  ?>  ?>


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1