<?php
//<a href="xx.php">你要进入允许页面</a>
$com_4 ="";
$self = "http://www.qidizi.com/1.htm";//写明要从那里来的才能查看,
$host ="/";//这里放不符合要跳转到的地址 如http://www.qidizi.com/, 主页直接/

if (isset($_SERVER['HTTP_REFERER']))
{
  $com_4 = $_SERVER['HTTP_REFERER'];
}

if ($com_4!=$self )
{
  header("Location:".$host);
}

?>