当前位置: 首页 > 图文教程 > 网络编程 > 正则表达式 > 正则表达式检查来访IP是否合法的实际应用

正则表达式
DreamWeaver中使用正则技术搜索
代替正则——HyperScriptExpression联合开发倡议公告
正则入门连载!(献给不及格的程序员们)
请教一个正则表达式,匹配所有Html标签外部的指定字符串
php正则表达式中的非贪婪模式匹配
js中2005-05-02怎么转换为2005/5/2?
用正则表达式格式化html标签的代码
php利用正则表达式取出图片的URL
用正则取出html页面中script段落里的内容
学习正则表达式30分钟入门教程(第二版)
只能是字母或数字或者是字母和数字的组合的正则previousSibling
[php]正则表达式的五个成功习惯
常用正则表达式语法例句
正则表达式基础教程 regular expression
php中正则表达式中的特殊符号
PHP和正则表达式教程集合之一
PHP和正则表达式教程集合之二
用正则实现提取代码内容的代码
php正则之函数 preg_replace()参数说明
关于preg_replace函数的问题讲解

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 47 ::
收藏到网摘: n/a

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

sub chkIP(boardid)
dim rsIP
dim ipArr
dim ignored
dim i
dim ip
dim sql
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