软件教程

ASP测试IP是否合法的实际应用

来源: 本站    类别: 软件教程    日期: 2013/5/2

 sub chkIP(boardid)
dim rsIP
dim ipArr
dim ignored
dim i
dim ip
dim sql</P><P>ip=Request.ServerVariables("REMOTE_ADDR")
ignored=false
if not isempty(boardid) then
sql="select ignoreip from board where boardid="&cstr(boardid)
set rsIP=conn.execute(sql)
if not (rsIP.eof and rsIP.bof) then
if instr(cstr(rsIP("ignoreip")&""),chr(13)&chr(10)) then
iparr=split(rsIP("ignoreip"),chr(13)&chr(10))
for i=0 to ubound(iparr)
if trim(iparr(i))<>"" and left(ip,len(trim(iparr(i))))=trim(iparr(i)) then
ignored=true
exit for
end if
next
else
iparr=rsIP("ignoreip")
if ip=trim(iparr) then
ignored=true
end if
end if
end if
rsIP.close
end if
if ignored then
response.write "<script language=javascript>window.location.href='ignoreip.htm'</script>"
end if
end sub

相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com