note 90656 added to reserved.variables.server
| From: | pudding06 at gmail dot com | Date: | Sat, 02 May 2009 21:44:20 +0000 |
| Subject: | note 90656 added to reserved.variables.server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154151@lists.php.net to get a copy of this message | ||
Here's a simple, quick but effective way to block unwanted external visitors to your local
server:
// only local requests
if ($_SERVER['REMOTE_ADDR'] !== '127.0.0.1') die(header("Location:
/"));
This will direct all external traffic to your home page. Of course you could send a 404 or other
custom error. Best practice is not to stay on the page with a custom error message as you
acknowledge that the page does exist. That's why I redirect unwanted calls to (for example)
phpmyadmin.
----
Server IP: 92.48.74.199
Probable Submitter: 94.196.119.115
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.server.php
Edit -- https://master.php.net/note/edit/90656
Del: integrated -- https://master.php.net/note/delete/90656/integrated
Del: useless -- https://master.php.net/note/delete/90656/useless
Del: bad code -- https://master.php.net/note/delete/90656/bad+code
Del: spam -- https://master.php.net/note/delete/90656/spam
Del: non-english -- https://master.php.net/note/delete/90656/non-english
Del: in docs -- https://master.php.net/note/delete/90656/in+docs
Del: other reasons-- https://master.php.net/note/delete/90656
Reject -- https://master.php.net/note/reject/90656
Search -- https://master.php.net/manage/user-notes.php