note 80083 deleted from reserved.variables by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 18:29:01 +0000 |
| Subject: | note 80083 deleted from reserved.variables by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134376@lists.php.net to get a copy of this message | ||
Note Submitter: J. Ide
----
Slight improvements to the IP-deduction code posted on 16-Nov-2007 01:44 that was based on
dlyaza's code (22-Oct-2006 12:33):
<?php
/**
* Returns the IP address of the client that made the HTTP
* request. On failure, FALSE is returned.
*/
function getClientIPAddress()
{
($ip = $_SERVER['HTTP_CLIENT_IP']) ||
($ip = $_SERVER['HTTP_X_FORWARDED_FOR']) ||
($ip = $_SERVER['HTTP_X_FORWARDED']) ||
($ip = $_SERVER['HTTP_FORWARDED_FOR']) ||
($ip = $_SERVER['HTTP_FORWARDED']) ||
($ip = $_SERVER['REMOTE_ADDR']);
return $ip ? $ip : false;
}
?>