note 114949 deleted from reserved.variables.server by tularis
| From: | tularis@php.net | Date: | Sun, 04 May 2014 09:04:27 +0000 |
| Subject: | note 114949 deleted from reserved.variables.server by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199406@lists.php.net to get a copy of this message | ||
Note Submitter: ivijan dot stefan at gmail dot com
----
How to find real IP adress from visitors?
This is that function:
<?php
function IP()
{
if(!empty($_SERVER['HTTP_CLIENT_IP']))
{
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
else
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
else $ip = $_SERVER['REMOTE_ADDR'];
return (!empty($ip)?trim($ip):false);
}
echo 'Your real IP is: '.IP();
?>
Use this helper and be happy! :)