Revision: 15618
Updated Code
at July 12, 2009 00:36 by DrewDouglass
Updated Code
<?php
function getRealIpAddr(){
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;
}
?>
Revision: 15617
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 12, 2009 00:35 by DrewDouglass
Initial Code
<?php
function getRealIpAddr(){
if (!emptyempty($_SERVER['HTTP_CLIENT_IP'])){
//check ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
elseif (!emptyempty($_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;
}
?>
Initial URL
http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html
Initial Description
All credit for this snippet goes to Roshan, link is given above.
Initial Title
Get Real IP Address with PHP
Initial Tags
php
Initial Language
PHP