more sophisticated remote_addr determining

This commit is contained in:
Vladimir 2012-06-30 01:57:01 +04:00 committed by Martin Konecny
parent 6a4fd4973e
commit 1e76845e9c
2 changed files with 15 additions and 1 deletions

View file

@ -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);