设为首页
加入收藏
联系站长
您现在的位置: 网贝 >> 建站学院 >> ASP技术 >> 安全加密 >> 文章正文 用户登录 新用户注册
asp中对ip进行过滤限制函数         ★★★★
asp中对ip进行过滤限制函数
相关网站:
作者:佚名 文章来源:网贝整理|http://www.csdn.net 点击数: 更新时间:2004-9-23
 看了一些IP限制的函数,觉得太复杂。所以,试着写了一个,比较简单。请网友参考指教。谢谢!~

代码拷贝框

<%
'获取访问者的地址
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
%>

 


 

文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    相关网站:

    文章 下载 图片
    普通文章服务器如何防范asp木
    普通文章ASP登陆验证页应做的
    推荐文章小琦的原创asp数据库
    普通文章ASP限制IP访问的小代
    普通文章得到真实IP
    普通文章限制某段IP地址
    普通文章给文件加密的一种方
    普通文章asp中对ip进行过滤限
    推荐文章小琦的原创asp数据库
    推荐文章[组图]Asp的安全管理
    推荐文章ASP漏洞分析和解决方
    普通文章把手教你写私服列表
    普通文章WEB标准
    普通文章GOOGLE sitemap官方
    普通文章用php定制404错误页
    普通文章WAP(wml)开发问答
    普通文章[组图]PS教程系列:快
    普通文章时使用apache和IIS,
    普通文章[组图]2005年的第一
    推荐文章[组图]彻底掌握IIS6
    推荐文章[组图]CSS 全攻略
    推荐文章各种脚本错误详解!
    推荐文章直接生成XML的Googl
    推荐文章九个常见的错误原因
    推荐文章Win XP家用版也能装
    推荐文章JSP入门初级教程之J
    推荐文章ASP入门及提高
  • 利用代码实现对i


  • Asp的安全管理
    (只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    Copyright © 2003-2005 NetBei.com All rights reserved.