Deny Remote Access (Only allow Localhost)
Posted: Thu May 08, 2008 10:38 am
Am I right in saying that if I have the following at the top of my script then that particular page cannot be accessed remotely?
I'm developing an app for a client who will be using it only on his own PC, and it's not meant for anybody else to access. Although there isn't going to be any highly sensitive information (the app is password protected anyway), I'd just prefer that nobody having the IP address can snoop around.
Code: Select all
<?php
if( $_SERVER['HTTP_HOST'] != 'localhost' || $_SERVER['SERVER_NAME'] != 'localhost' )
{
die("Remote access denied");
}
?>