Asp实现禁止IP访问代码
作者:admin 日期:2011-10-19
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原创代码,转载请注明出处!
广告位