asp中对ip进行过滤限制函数
2014-04-24 09:18
253 查看
asp中对ip进行过滤限制函数
看了一些IP限制的函数,觉得太复杂。所以,试着写了一个,比较简单。请网友参考指教。谢谢!~
代码拷贝框
<%'获取访问者的地址ip=Request.ServerVariables("REMOTE_ADDR") '允许的IP地址段为10.0.0.0~10.68.63.255allowip1="10.0.0.0"allowip2="10.68.10.71"response.write checkip(ip,allowip1,allowip2)function checkip(ip,allowip1,allowip2)dim check(4)checkip=falseipstr=split(ip,".")allow1=split(allowip1,".")allow2=split(allowip2,".")if
cint(allow1(0))>cint(allow2(0)) then '判断IP地址段是否合法response.write "IP地址段出错!"exit functionend iffor i=0 to ubound(ipstr)if cint(allow1(i))<cint(allow2(i)) thenif cint(allow1(i))=cint(ipstr(i)) thencheck(i)=truecheckip=trueexit forelseif cint(ipstr(i))<cint(allow2(i))
thencheck(i)=truecheckip=trueexit forelseif cint(ipstr(i))>cint(allow2(i)) thencheck(i)=falsecheckip=falseexit forelsecheck(i)=truecheckip=trueend ifend ifend ifelseif cint(allow1(i))>cint(ipstr(i)) or cint(allow1(i))<cint(ipstr(i)) thencheck(i)=falsecheckip=falseif
i<>ubound(ipstr) thenexit forend ifelsecheck(i)=trueend ifend ifnextif (check(0)=true and check(1)=true and check(2)=true and check(3)=false) and (cint(allow2(2))>cint(ipstr(2))) thencheckip=trueend ifend function%>
看了一些IP限制的函数,觉得太复杂。所以,试着写了一个,比较简单。请网友参考指教。谢谢!~
代码拷贝框
<%'获取访问者的地址ip=Request.ServerVariables("REMOTE_ADDR") '允许的IP地址段为10.0.0.0~10.68.63.255allowip1="10.0.0.0"allowip2="10.68.10.71"response.write checkip(ip,allowip1,allowip2)function checkip(ip,allowip1,allowip2)dim check(4)checkip=falseipstr=split(ip,".")allow1=split(allowip1,".")allow2=split(allowip2,".")if
cint(allow1(0))>cint(allow2(0)) then '判断IP地址段是否合法response.write "IP地址段出错!"exit functionend iffor i=0 to ubound(ipstr)if cint(allow1(i))<cint(allow2(i)) thenif cint(allow1(i))=cint(ipstr(i)) thencheck(i)=truecheckip=trueexit forelseif cint(ipstr(i))<cint(allow2(i))
thencheck(i)=truecheckip=trueexit forelseif cint(ipstr(i))>cint(allow2(i)) thencheck(i)=falsecheckip=falseexit forelsecheck(i)=truecheckip=trueend ifend ifend ifelseif cint(allow1(i))>cint(ipstr(i)) or cint(allow1(i))<cint(ipstr(i)) thencheck(i)=falsecheckip=falseif
i<>ubound(ipstr) thenexit forend ifelsecheck(i)=trueend ifend ifnextif (check(0)=true and check(1)=true and check(2)=true and check(3)=false) and (cint(allow2(2))>cint(ipstr(2))) thencheckip=trueend ifend function%>
相关文章推荐
- 对 ip 进行过滤限制函数
- .NET:在ASP.NET中如何进行IP限制
- ASP中实现限制IP的函数详解
- asp下实现IP限制函数代码
- ASP中实现限制IP的函数详解
- ASP和PHP限制IP访问 只允许指定IP访问 允许*号通配符过滤IP
- asp下实现IP限制函数代码
- .NET:在ASP.NET中如何进行IP限制
- ASP过滤html函数只保留纯文字
- asp.net过滤HTML标签的几个函数
- asp 过滤非法字符函数
- Asp过滤指定html标签函数
- asp 实现对SQL注入危险字符进行重编码处理的函数
- asp 获取参数值与sql安全过滤参数函数代码
- ASP.NET中使用Eval()函数绑定数据时,不能使用IF进行逻辑判断的解决方案
- 过滤ip的函数|过滤ip的函数
- 读取指定文件夹下的全部文件,可通过正则进行过滤,返回文件路径数组 -- 基于node的一个函数
- ASP常用函数:CLngIP()
- 您可以在您的asp程序中使用如下函数来进行在线发信
- ThinkPHP中的过滤函数[可以对对象,数组,字符串进行递归过滤]