note 102463 added to reserved.variables.server

[email protected] Wed, 16 Feb 2011 06:26:50 -0800
Newsgroups php.notes
Message-ID <[email protected]>
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).
----
Server IP: 69.147.83.197
Probable Submitter: 58.38.7.58
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.server.php
Edit        -- https://master.php.net/note/edit/102463
Del: integrated  -- https://master.php.net/note/delete/102463/integrated
Del: useless     -- https://master.php.net/note/delete/102463/useless
Del: bad code    -- https://master.php.net/note/delete/102463/bad+code
Del: spam        -- https://master.php.net/note/delete/102463/spam
Del: non-english -- https://master.php.net/note/delete/102463/non-english
Del: in docs     -- https://master.php.net/note/delete/102463/in+docs
Del: other reasons-- https://master.php.net/note/delete/102463
Reject      -- https://master.php.net/note/reject/102463
Search      -- https://master.php.net/manage/user-notes.php