近期网站流量暴涨不正常对index,进行修改
<?php /* session_start(); if(!isset($_SESSION['id'])or !isset($_SESSION['member'])){ echo "验证session ";//验证session exit(); } */ $ref=$_SERVER['HTTP_REFERER']; if($ref==''){ echo '<meta http-equiv="refresh" content="0;url=https://www.homeh.cc/index.html"> '; exit(); }else{ $servername=$_SERVER['SERVER_NAME']; $sub_len=strlen($servername); $checkfrom=substr($ref,8,$sub_len); if($checkfrom!=$servername){ echo "<script language='javascript'>window.alert('数据来源有误," . $checkfrom . $servername . "本站不接收站外提交的数据!');window.opener=self;window.close();</script>"; exit; } /* $url=parse_url($ref); if($url[host]!='127.0.0.1'&& $url[host]!='localhost'){ // echo '不允许盗链'; echo '不允许盗链1111111111,<meta http-equiv="refresh" content="0;url=https://www.homeh.cc/"> '; exit(); } */ } /* if(PHP_VERSION<'4.1.0'){$_SERVER = $HTTP_SERVER_VARS;} if(isset($_SERVER["HTTP_REFERER"])){ //针对部分浏览器可能无HTTP_REFERER,所以做这么一个判断 $servername=$_SERVER['SERVER_NAME']; $sub_from=$_SERVER["HTTP_REFERER"]; $sub_len=strlen($servername); $checkfrom=substr($sub_from,7,$sub_len); echo "<script language='javascript'>window.alert('数据来源有误,"&$checkfrom &"本站不接收站外提交的数据!');window.opener=self;window.close();</script>"; if($checkfrom!=$servername){ echo "<script language='javascript'>window.alert('数据来源有误,本站不接收站外提交的数据!');window.opener=self;window.close();</script>"; exit; } } */ ?>