|
本帖最后由 全球AV交流论坛 于 2016-3-18 20:17 编辑
把下面这段单独存成default.asp然后把default.asp的默认首页优先级设置到比index.asp高,这样就行了。
- <%
- dim ipcode
- ipcode=GetHttpPage("http://ip.taobao.com/service/getIpInfo.php?ip="&request.ServerVariables("REMOTE_ADDR"))
- if (InStr(ipcode,"河南省")>0 Or InStr(ipcode,"瓷器国")>0 Or InStr(ipcode,"MJJ市")>0) and instr(request.ServerVariables("HTTP_REFERER"),"baidu")=0 and instr(request.ServerVariables("HTTP_REFERER"),"google")=0 And Not IsWebSearch() then
- Response.Status="403 Forbidden"
- Response.write "<html><head><title>Error</title></head><body><head><title>Directory Listing Denied</title></head>"&Chr(13)&Chr(10)
- Response.write "<body><h1>Directory Listing Denied</h1>This Virtual Directory does not allow contents to be listed.</body></body></html>"
- Else
- response.redirect "index.asp"
- end If
- Function IsWebSearch()
- Dim Botlist,i
- BotList = "Google,Baiduspider,360Spider,Sogou web spider"
- Botlist = Split(Botlist,",")
- For i = 0 To Ubound(Botlist)
- If InStr(Lcase(Request.ServerVariables("HTTP_USER_AGENT")),Lcase(Botlist(i))) > 0 Then
- IsWebSearch = Botlist(i)
- Exit For
- End If
- Next
- End Function
- Function GetHttpPage(HttpUrl)
- Dim Http
- Set Http=server.createobject("WinHttp.WinHttpRequest.5.1")'Msxml2.ServerXMLHTTP
- Http.Option(6)=0
- Http.SetTimeouts 65000, 65000, 65000, 65000
- Http.open "GET",HttpUrl,False
- Http.setRequestHeader "ACCEPT-LANGUAGE","zh-CN"
- Http.setRequestHeader "USER-AGENT",request.ServerVariables("HTTP_USER_AGENT")
- Http.Send()
- GetHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
- Set Http=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
- %>
复制代码 |
|