国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

Asp下實現限制IP訪問的程序代碼

2020-07-27 13:10:30
字體:
來源:轉載
供稿:網友
<%
''獲取訪問者的地址
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
%>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 大港区| 图木舒克市| 原阳县| 台安县| 西乌珠穆沁旗| 信阳市| 望都县| 奉新县| 白城市| 通山县| 玉屏| 苏尼特右旗| 昭通市| 克什克腾旗| 舒城县| 襄垣县| 类乌齐县| 西藏| 礼泉县| 内江市| 连江县| 行唐县| 沂南县| 马龙县| 望江县| 扎囊县| 灯塔市| 东乌珠穆沁旗| 渝中区| 扎鲁特旗| 丰顺县| 怀集县| 东莞市| 确山县| 图们市| 蛟河市| 洛川县| 乌拉特中旗| 昭平县| 蒲城县| 三台县|