asp屏蔽指定地区禁止访问网站

2023-08-21阅读:2573

<%
SysSitePingbi="True"  '屏蔽开关
If SysSitePingbi="True" then
url="http://whois.pconline.com.cn/ip.jsp?ip="&request.ServerVariables("REMOTE_ADDR")
If Instr(getHTTPPage(url),"四川")>0 Then
  Response.Write ("网站建设中...")
  Response.End()
End if
End if

Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
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 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
%>


大家都爱看
查看更多热点文章