/[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.3 - (show annotations)
Sun Jun 20 19:49:02 2004 UTC (21 years, 9 months ago) by sysadm
Branch: MAIN
Changes since 1.2: +1 -0 lines
Add address of shmu-proxy

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

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