note 102463 deleted from reserved.variables.server by danbrown
[email protected] Wed, 16 Feb 2011 06:46:04 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
Note Submitter: will at gpslogapp dot com ---- An alternative way to pudding06 at gmail dot com's suggestion to prohibit non-local visitors. <?php ($_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']) or die(header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found")); ?> Rather than testing against 127.0.0.1, checks that the REMOTE_ADDR and the SERVER_ADDR are equal. Thus, the check will pass regardless of the IP address used in the request, but it will still restrict non-local visitors (who will be sent a 404).