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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu Jun 10 20:37:11 2004 UTC (21 years, 9 months ago) by sysadm
Branch: MAIN
Changes since 1.1: +34 -4 lines
Display client_address including those clients using proxy

1 <?
2
3 function Client_Address()
4 {
5 $proxy_ip = array(
6 "^61.129.42.22[01]$",
7 "^10.85.31.[0-9]{1,3}$",
8 "^192.168.176.57$"
9 );
10
11 foreach($proxy_ip as $ip)
12 {
13 if (ereg($ip,$_SERVER["REMOTE_ADDR"]))
14 {
15 if (isset($_SERVER["HTTP_X_CLIENT_ADDR"]))
16 {
17 $client_addr = explode(",",$_SERVER["HTTP_X_CLIENT_ADDR"]);
18 for($i=count($_SERVER["HTTP_X_CLIENT_ADDR"])-1;$i>=0;$i--)
19 {
20 $proxy = false;
21 foreach($proxy_ip as $ip)
22 {
23 if (ereg($ip,$_SERVER["REMOTE_ADDR"]))
24 $proxy = true;
25 }
26 if (!$proxy)
27 return trim($client_addr[$i]);
28 }
29 return trim($client_addr[0]);
30 }
31 else
32 {
33 return $_SERVER["REMOTE_ADDR"];
34 }
35 }
36 }
37
38 return $_SERVER["REMOTE_ADDR"];
39 }
40
41 ?>

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