代码 复制 - 运行

<?php
//+------------------------------------ 
//| 检查是否直接访问本页面 
//+------------------------------------ 
if (isset ( $_SERVER ['HTTP_REFERER'] )) {
 $url_array = explode ( '://', $_SERVER ['HTTP_REFERER'] );
 $url = explode ( '/', $url_array [1] );
 if ($_SERVER ['SERVER_NAME'] != $url [0]) {
// 您不是从本站来的;         
  exit ( 'Access Denied ! You are not coming from the site !' );
 }
} else {
// 禁止直接访问此页;     
 exit ( 'Access Denied ! ' );
}
?>