| 1 |
<? |
<? |
| 2 |
|
require_once "common.inc.php"; |
| 3 |
|
|
| 4 |
function Client_Address($addr=null,$x_addr=null) |
function Client_Address($addr=null,$x_addr=null) |
| 5 |
{ |
{ |
| 6 |
$proxy_ip = array( |
global $SYS_proxy_ip; |
| 7 |
"^61.129.42.22[01]$", |
|
| 8 |
"^10.85.31." |
$proxy_ip = $SYS_proxy_ip; |
|
); |
|
| 9 |
|
|
| 10 |
if ($addr == null) |
if ($addr == null) |
| 11 |
$addr = $_SERVER["REMOTE_ADDR"]; |
$addr = $_SERVER["REMOTE_ADDR"]; |
| 12 |
|
|
| 13 |
if ($x_addr == null && isset($_SERVER["HTTP_X_CLIENT_ADDR"])) |
if ($x_addr == null && isset($_SERVER["HTTP_X_FORWARDED_FOR"])) |
| 14 |
$x_addr = $_SERVER["HTTP_X_CLIENT_ADDR"]; |
$x_addr = $_SERVER["HTTP_X_FORWARDED_FOR"]; |
| 15 |
|
|
| 16 |
foreach($proxy_ip as $ip) |
foreach($proxy_ip as $ip) |
| 17 |
{ |
{ |
| 18 |
if (ereg($ip,$addr)) |
if (ereg($ip[0],$addr)) |
| 19 |
{ |
{ |
| 20 |
if ($x_addr != null) |
if ($x_addr != null) |
| 21 |
{ |
{ |
| 25 |
$proxy = false; |
$proxy = false; |
| 26 |
foreach($proxy_ip as $ip) |
foreach($proxy_ip as $ip) |
| 27 |
{ |
{ |
| 28 |
if (ereg($ip,$client_addr[$i])) |
if (ereg($ip[0],$client_addr[$i])) |
| 29 |
$proxy = true; |
$proxy = true; |
| 30 |
} |
} |
| 31 |
if (!$proxy) |
if (!$proxy) |