Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Getting real IP address in PHP
SUBMITTED BY:
Guest
DATE:
Jan. 15, 2014, 11:22 p.m.
FORMAT:
PHP
SIZE:
373 Bytes
Raw
Download
Tweet
HITS:
802
Go to comments
Report
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;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus