预览模式: 普通 | 列表

Asp实现禁止IP访问代码

function banip(ip)
banips="221.204.*.*|118.74.*.*"
str=split(banips,"|")
ipstr=split(ip,".")
for i=lbound(str) to ubound(str)
 ban=true
 str2=split(str(i),".")
 for j=lbound(str2) to ubound(str2)
  if str2(j)<>ipstr(j) and str2(j)<>"*" then
  ban=false
  end if
 next
 if ban=true then
 banip=ban
 exit function
 end if
next
end function

使用示例:
ip="59.49.78.57"
if banip(ip)=true then
response.Write("IP被禁止访问!")
response.End()
end if

www.jlist.cn原创代码,转载请注明出处!

查看更多...

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2443

 广告位

↑返回顶部↑