Return to Snippet

Revision: 31325
at September 3, 2010 01:00 by wireplay


Initial Code
<?php
function getRealIpAddr()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
		$ip=$_SERVER['HTTP_CLIENT_IP'];
	} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
		$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
      	$ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}
$useripaddress =  getRealIpAddr();

echo $useripaddress;
?>

Initial URL


Initial Description


Initial Title
PHP - Get Real IP Address

Initial Tags
php

Initial Language
PHP