more sophisticated remote_addr determining
This commit is contained in:
parent
6a4fd4973e
commit
1e76845e9c
2 changed files with 15 additions and 1 deletions
|
@ -1,6 +1,20 @@
|
|||
<?php
|
||||
class Application_Model_ServiceRegister {
|
||||
|
||||
public static function GetRemoteIpAddr(){
|
||||
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])){
|
||||
//check ip from share internet
|
||||
$ip=$_SERVER['HTTP_CLIENT_IP'];
|
||||
}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
|
||||
//to check ip is pass from proxy
|
||||
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}else{
|
||||
$ip=$_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
return $ip;
|
||||
}
|
||||
|
||||
public static function Register($p_componentName, $p_ipAddress){
|
||||
|
||||
$component = CcServiceRegisterQuery::create()->findOneByDbName($p_componentName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue