正则表达式检查来访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"
endif
endsub
新闻热点
疑难解答