Free JavaScripts provided
by The JavaScript Source
Last updated on
function get_client_ip ()
{
// Get REMOTE_ADDR as the Client IP.
$client_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
// Check for headers used by proxy servers to send the Client IP. We should look for HTTP_CLIENT_IP before HTTP_X_FORWARDED_FOR.
if ($_SERVER["HTTP_CLIENT_IP"])
$proxy_ip = $_SERVER["HTTP_CLIENT_IP"];
elseif ($_SERVER["HTTP_X_FORWARDED_FOR"])
$proxy_ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
// Proxy is used, see if the specified Client IP is valid. Sometimes it's 10.x.x.x or 127.x.x.x... Just making sure.
if ($proxy_ip)
{
if ( preg_match("/^([0-9]+.[0-9]+.[0-9]+.[0-9]+)/", $proxy_ip, $ip_list) )
{
$private_ip = array('/^0./', '/^127.0.0.1/', '/^192.168..*/', '/^172.16..*/', '/^10..*/', '/^224..*/', '/^240..*/');
$client_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
}
}
// Return the Client IP.
return $client_ip;
}
?>
| Click the graphic below to go to the jokes index. |

|
Last updated on
| Click the graphic below to go to my site index! |

|
| Click on the globe to go to my Guest map! |

|
If you don't like the content in this site...
OR you're under 18 years old...
PLEASE click the ~~> EXIT!!!
|