<!-- #include file="Conn.asp" -->
<%
SiteSettings=Conn.Execute("[BBSXP_SiteSettings]")
CookieUserName=HTMLEncode(unescape(Request.Cookies("UserName")))
if CookieUserName<>empty then
'第一次来''
if Request.Cookies("Onlinetime")=empty then
Conn.execute("update [BBSXP_Users] set UserDegree=UserDegree+1,UserLandTime="&SqlNowString&",UserLastIP='"&Request.ServerVariables("REMOTE_ADDR")&"' where UserName='"&CookieUserName&"'")
Response.Cookies("Onlinetime")=now()
end if
'
sql="select * from [BBSXP_Users] where UserName='"&CookieUserName&"'"
Set Rs=Conn.Execute(SQL)
if Rs.eof then Response.Cookies("UserName")=""
if Request.Cookies("Userpass") <> Rs("Userpass") then Response.Cookies("UserName")=""
membercode=Rs("membercode")
Userface=""&Rs("Userface")&""
NewMessage=Rs("NewMessage")
UserVIP=Rs("UserVIP")
set rs=nothing
end if
if SiteSettings("BannedIP")<>"" then
filtrate=split(SiteSettings("BannedIP"),"|")
for i = 0 to ubound(filtrate)
if instr("|"&Request.ServerVariables("REMOTE_ADDR")&"","|"&filtrate(i)&"") > 0 then response.redirect "Include/BannedIP.htm"
next
end if
if Request.Cookies("skins")=empty then Response.Cookies("skins")=SiteSettings("DefaultSiteStyle")
chaxun=HTMLEncode(Request("skins"))
sql="select * from BBSxp_Style where Styleurl='"&chaxun&"'"
Set Rs=Conn.Execute(SQL)
if not rs.eof then
StyleAD=rs("StyleAD")
else
StyleAD=0
end if
set rs=nothing
if ""&SiteSettings("nowdate")&""<>""&date()&"" then
Conn.execute("update [BBSXP_SiteSettings] set Nowdate='"&date()&"'")
Conn.execute("update [BBSXP_Statistics_Site] set TodayPost=0")
Conn.execute("update [BBSXP_Forums] set ForumToday=0")
end if
參考答案:if SiteSettings("BannedIP")<>"" then
filtrate=split(SiteSettings("BannedIP"),"|")
for i = 0 to ubound(filtrate)
if instr("|"&Request.ServerVariables("REMOTE_ADDR")&"","|"&filtrate(i)&"") > 0 then response.redirect "Include/BannedIP.htm"
next
end if
这一段就是判断来访者的ip是否在系统配置的在禁止访问的列表内。
'如果系统禁止的ip不为空则执行下面内容
if SiteSettings("BannedIP")<>"" then
'把系统禁止的ip列表分解到数组 filtrate
filtrate=split(SiteSettings("BannedIP"),"|")
'循环列出filtrate的项目,就是一个个的ip
for i = 0 to ubound(filtrate)
'看看来访的ip有没有出现过,如果有就重定向到BannedIP.htm这个页面
if instr("|"&Request.ServerVariables("REMOTE_ADDR")&"","|"&filtrate(i)&"") > 0 then response.redirect "Include/BannedIP.htm"
next
end if