最强PHP防镜像代码收集,简单粗暴...你值得拥有

    JS版本

  

<script type="text/javascript">
if(location.toString().indexOf("yuanzhumuban.cc")<=-1){document.location.href="http://zhimo.yuanzhumuban.cc";} </script>

  

<div style="display:none;">
<script>proxy2016 = false;</script>
<img src=" " onerror='setTimeout(function(){if(typeof(proxy2016)=="undefined"){window.location.host="yuanzhumuban.cc";}},3000);'>
</div>

   

PHP通用版本

  将下面的代码贴到网站入口文件index.php中的第一个 <?php之后即可:

  

//防止恶意HTTP_USER_AGENT采集
$ua = $_SERVER['HTTP_USER_AGENT'];
$now_ua = array('FeedDemon ','BOT/0.1 (BOT for JCE)','CrawlDaddy ','Java','Feedly','UniversalFeedParser','ApacheBench','Swiftbot','ZmEu','Indy Library','oBot','jaunty','YandexBot','AhrefsBot','MJ12bot','WinHttp','EasouSpider','HttpClient','Microsoft URL Control','YYSpider','jaunty','Python-urllib','lightDeckReports Bot','PHP'); 
if(!$ua) {
header("Content-type: text/html; charset=utf-8");
    die('请勿采集本站,采集者木有小JJ!请正常访问!');
}else{
    foreach($now_ua as $value )
    if(eregi($value,$ua)) {
    header("Content-type: text/html; charset=utf-8");
    die('请勿采集本站,采集者木有小JJ!请正常访问!');
    }
}

  

posted @ 2019-09-27 11:09  圆柱模板  阅读(482)  评论(0编辑  收藏  举报