https://www.icyphoenix.com/viewtopic.php?f=35&t=6611&p=45335#p45335
-----------------------------------
Informpro
Sat 24 Oct, 2009 09:15

Re: Analisys For Luca
-----------------------------------
use this function instead (for get IP address):
[code syntax="php"]function get_ip()
	{
		if($_SERVER)
			{
				if($_SERVER['HTTP_X_FORWARDED_FOR'])
					$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
				elseif($_SERVER['HTTP_CLIENT_IP'])
					$ip = $_SERVER['HTTP_CLIENT_IP'];
				else
					$ip = $_SERVER['REMOTE_ADDR'];
			}
	  else
		{
			if(getenv('HTTP_X_FORWARDED_FOR'))
				$ip = getenv('HTTP_X_FORWARDED_FOR');
			elseif(getenv('HTTP_CLIENT_IP'))
				$ip = getenv('HTTP_CLIENT_IP');
			else
				$ip = getenv('REMOTE_ADDR');
		}

		return $ip;
	}[/code]
and for the foreach, use this instead:[code syntax="php"]$ip_user = get_ip();
$key_ip_user = explode('.', $ip_user);
foreach($ip as $ip_string => $get_ip_string)
    {
        if(in_array($ip_string, $key_ip_user))
        {
            return $get_ip_string;
            break;
        }
    } [/code]


