资源大全 | 神秘文化 | 在线翻译 | QQ专区 | 视频教程 | 彩信频道 | 搜索引擎 | BT下载 |  | 网站地图
设为首页
加入收藏
联系站长
您现在的位置: 一百网络 >> ASP编程 >> ASP技术 >> 文章正文
最近更新
普通文章 多域名一网站时如何返回
普通文章 一个把数字转英文的实用
普通文章 如何对身份证的籍贯进行
推荐文章 生成一个不重复的随即数
普通文章 如何对身份证的籍贯进行
推荐文章 生成一个不重复的随即数
普通文章 使用Server.scripttimeo
普通文章 用ASP在ACCESS中插入图片
推荐文章 如何使ASP程序暂停指定的
推荐文章 检测整数和长整数的函数
推荐文章
推荐文章 生成一个不重复的随即数
推荐文章 生成一个不重复的随即数
推荐文章 如何使ASP程序暂停指定的
推荐文章 检测整数和长整数的函数
推荐文章 Asp限制IP访问
Asp限制IP访问

文章作者:佚名 录入时间:2006-5-31 来源:不详
网站声明:本站的文章除部分特别声明禁止转载的专稿外,可以自由转载.但请务必注明出处和原始作者,文章版权归本网站与文章作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。


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

  • 上一篇文章: 没有了

  • 下一篇文章:
  •     查找更多“Asp限制IP访问”的内容  
    相关连接
  • 奇妙的文件系统对象组件

  • 读取目录下的文件得到一个数组

  • ASP中FSO的神奇功能 - 简介

  • ASP中FSO的神奇功能 - 写文件

  • ASP中FSO的神奇功能 - 文件读取