手机
当前位置:查字典教程网 >编程开发 >ASP教程 >asp中对ip进行过滤限制函数
asp中对ip进行过滤限制函数
摘要:看了一些IP限制的函数,觉得太复杂。所以,试着写了一个,比较简单。请网友参考指教。谢谢!~cint(allow2(0))then'判断IP地...

看了一些IP限制的函数,觉得太复杂。所以,试着写了一个,比较简单。请网友参考指教。谢谢!~

<%<BR> '获取访问者的地址<BR> ip=Request.ServerVariables("REMOTE_ADDR") <BR> <BR> '允许的IP地址段为10.0.0.0~10.68.63.255<BR> allowip1="10.0.0.0"<BR> allowip2="10.68.10.71"<BR> <BR> response.write checkip(ip,allowip1,allowip2)<BR> <BR> <BR> function checkip(ip,allowip1,allowip2)<BR> dim check

(4)<BR> checkip=false<BR> ipstr=split(ip,".")<BR> allow1=split(allowip1,".")<BR> allow2=split(allowip2,".")<BR> if cint(allow1(0))>cint(allow2(0)) then '判断IP地址段是否合法<BR> response.write "IP地址段出错!"<BR> exit function<BR> end if<BR> for i=0 to ubound(ipstr)<BR> if cint(allow1(i))<cint(allow2(i)) then<BR> if cint(allow1(i))=cint(ipstr(i)) then<BR> check(i)=true<BR> checkip=true<BR> exit for<BR> else<BR> if cint(ipstr(i))<cint(allow2(i)) then<BR> check(i)=true<BR> checkip=true<BR> exit for<BR> else<BR> if cint(ipstr(i))>cint(allow2(i)) then<BR> check(i)=false<BR> checkip=false<BR> exit for<BR> else<BR> check(i)=true<BR> checkip=true<BR> end if<BR> end if<BR> end if<BR> else<BR> if cint(allow1(i))>cint(ipstr(i)) or cint(allow1(i))<cint(ipstr(i)) then<BR> check(i)=false<BR> checkip=false<BR> if i<>ubound(ipstr) then<BR> exit for<BR> end if<BR> else<BR> check(i)=true<BR> end if<BR> end if<BR> next<BR> <BR> if (check(0)=true and check

(1)=true and check

(2)=true and check

(3)=false) and (cint(allow2

(2))>cint(ipstr

(2))) then<BR> checkip=true<BR> end if<BR> <BR> end function<BR> %>

【asp中对ip进行过滤限制函数】相关文章:

asp 过滤简单html代码程序

asp最常用的分页函数

ASP 中Split 函数的实例

asp中for循环的使用方法

一个可以自动创建多级目录的函数

asp 常用的字符串处理函数

asp 日期格式化函数

asp中Byval与Byref的区别

Object对象的一些的隐藏函数介绍

asp 中常用的文件处理函数

精品推荐
分类导航