zoukankan      html  css  js  c++  java
  • PHP如何防采集方法代码

    1 <?php
    2 /**
    3 * FileName:test.php
    4 * Summary: 防采集
    5 * Author: sinob
    6 * CreateTime: 2005-10-18
    7 * LastModifed:2005-10-18
    8 * 请参见http://mall.yi85.com/
    9 */
    10 $HTTP_REFERER = $_SERVER["HTTP_REFERER"];
    11 $HTTP_USER_AGENT = $_SERVER["HTTP_USER_AGENT"];
    12 $SERVER_NAME = $_SERVER["SERVER_NAME"];
    13 $CompCharArr = explode(",","Baiduspider,Scooter,ia_archiver,Googlebot,FAST-WebCrawler,MSNBOT,Slurp");
    14 $CompCharArrSize = sizeof($CompCharArr);
    15 $CheckSign = "";
    16 for($i=0;$i<$CompCharArrSize;$i++)
    17 {
    18 $ComChar = trim($CompCharArr[$i]);
    19 if($CompChar<>"" && eregi($CompChar,$HTTP_USER_AGENT))
    20 {
    21 $CheckSign = "T";
    22 }
    23 }
    24 $SERVER_NAME_M = "http://".$SERVER_NAME;//strlen
    25   $EndLenth = strlen($SERVER_NAME_M) + 1;
    26 $CompServerName = "http://".$SERVER_NAME."/";
    27 if(empty($CheckSign) && ($HTTP_REFERER == "" or substr($HTTP_REFERER,0,$EndLenth) <> $CompServerName ))
    28 {
    29 ?>
    30 <html>
    31 <body>
    32 <form action=' name=checkrefer id=checkrefer method=post></form>
    33 <script>
    34 document.all.checkrefer.action=document.URL;
    35 document.all.checkrefer.submit();
    36 <?php }?>

    aliyun活动 https://www.aliyun.com/acts/limit-buy?userCode=re2o7acl
  • 相关阅读:
    expect 函数体 花括号
    bash 连接字符串
    Ubuntu下搭建Python开发环境
    expect
    >&2
    expect语法基础: while、for 循环、if 语句的用法示例
    bash exit
    python开发工具
    eclipse中安装adt出现了duplicate location错误怎样解决
    shell source
  • 原文地址:https://www.cnblogs.com/wangbin/p/1871546.html
Copyright © 2011-2022 走看看