It is worthwhile to check with phpinfo() function if sever variables are all available for your server to implement the code as below.

$pos = strpos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']);
if($pos===false)
  die('Restricted access');

Leave a Reply

Your email address will not be published. Required fields are marked *