note 18143 modified in language.variables.predefined by philip
| From: | philip@php.net | Date: | Sun, 08 Dec 2002 02:13:19 +0000 |
| Subject: | note 18143 modified in language.variables.predefined by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40501@lists.php.net to get a copy of this message | ||
This page had a useful suggestion for a problem we were having with $REMOTE_ADDR:
http://www.faqts.com/knowledge_base/view.phtml/aid/186
Sometimes you may get the IP of the ISP Cache Server which of course you do not want. To make sure
you get the correct IP Address, the following may help:
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARD_FOR');
$host = gethostbyaddr($ip);
} else {
$ip = getenv('REMOTE_ADDR');
$host = gethostbyaddr($ip);
}
--was--
This page had a useful suggestion for a problem we were having with $REMOTE_ADDR:
http://www.faqts.com/knowledge_base/view.phtml/aid/186
Sometimes you may get the IP of the ISP Cache Server which of course you do not want. To make sure
you get the correct IP Address, the following may help:
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ip = getenv('HTTP_X_FORWARD_FOR');
$host = gethostbyaddr($ip);
} else {
$ip = getenv('REMOTE_ADDR');
$host = gethostbyaddr($ip);
}
http://www.php.net/manual/en/language.variables.predefined.php