note 102463 deleted from reserved.variables.server by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Feb 2011 14:46:04 +0000 |
| Subject: | note 102463 deleted from reserved.variables.server by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177031@lists.php.net to get a copy of this message | ||
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).