欢迎来到福编程网,本站提供各种互联网专业知识!

正则表达式检查来访IP是否合法的实际应用

发布时间:2007-04-06 作者: 来源:转载
正则表达式检查来访IP是否合法的实际应用subchkIP(boardid)dimrsIPdimipArrdimignoreddimidimipdimsqlip=Request.ServerVariables("REMOTE_ADDR")ignored=falseifnotisempty(boardid)thensql="selectignoreipfromboardwhereboardid="&cstr(boardid)s
正则表达式检查来访IP是否合法的实际应用


subchkIP(boardid)
dimrsIP
dimipArr
dimignored
dimi
dimip
dimsql
ip=Request.ServerVariables("REMOTE_ADDR")
ignored=false
ifnotisempty(boardid)then
sql="selectignoreipfromboardwhereboardid="&cstr(boardid)
setrsIP=conn.execute(sql)
ifnot(rsIP.eofandrsIP.bof)then
ifinstr(cstr(rsIP("ignoreip")&""),chr(13)&chr(10))then
iparr=split(rsIP("ignoreip"),chr(13)&chr(10))
fori=0toubound(iparr)
iftrim(iparr(i))<>""andleft(ip,len(trim(iparr(i))))=trim(iparr(i))then
ignored=true
exitfor
endif
next
else
iparr=rsIP("ignoreip")
ifip=trim(iparr)then
ignored=true
endif
endif
endif
rsIP.close
endif
ifignoredthen
response.write"window.location.href='ignoreip.htm'"
endif
endsub


相关推荐