|
|
|
asp中对ip进行过滤限制函数 |
|
|
| http://www.iyit.net 日期:2005-11-24 17:25:59 来源:易特网络技术 点击: |
<% ’获取访问者的地址 ip=request.servervariables("remote_addr") ’允许的ip地址段为10.0.0.0~10.68.63.255 allowip1="10.0.0.0" allowip2="10.68.10.71" response.write checkip(ip,allowip1,allowip2)
function checkip(ip,allowip1,allowip2) dim check(4) checkip=false ipstr=split(ip,".") allow1=split(allowip1,".") allow2=split(allowip2,".") if cint(allow1(0))>cint(allow2(0)) then ’判断ip地址段是否合法 response.write "ip地址段出错!" exit function end if for i=0 to ubound(ipstr) if cint(allow1(i))<cint(allow2(i)) then if cint(allow1(i))=cint(ipstr(i)) then check(i)=true checkip=true exit for else if cint(ipstr(i))<cint(allow2(i)) then check(i)=true checkip=true exit for else if cint(ipstr(i))>cint(allow2(i)) then check(i)=false checkip=false exit for else check(i)=true checkip=true end if end if end if else if cint(allow1(i))>cint(ipstr(i)) or cint(allow1(i))<cint(ipstr(i)) then check(i)=false checkip=false if i<>ubound(ipstr) then exit for end if else check(i)=true end if end if next if (check(0)=true and check(1)=true and check(2)=true and check(3)=false) and (cint(allow2(2))>cint(ipstr(2))) then checkip=true end if end function %>
|
上一篇:不用golobal和session实现在线人数统计
下一篇:asp实现批量录入数据的实现
[发送给好友] [打印本页] [关闭窗口] [返回顶部] 转载请注明来源:http://www.iyit.net |
|
| 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 责任编辑: |
投稿作者: 易特网络技术 |
| 信息来源: 易特网络技术 |
录入时间: 2005-11-24 17:25:59 |
| 浏览次数: |
投稿信箱: shtghy@163.com |
|
|
|
|
|