欢迎来到天天文库
浏览记录
ID:49529273
大小:22.01 KB
页数:2页
时间:2020-03-02
《asp限制ip访问代码.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、ASP限制IP访问代码<%''获取访问者的地址ip=Request.ServerVariables("REMOTE_ADDR")''允许的IP地址段为10.0.0.0~10.50.50.255allowip1="10.0.0.0"allowip2="10.50.10.70"response.writecheckip(ip,allowip1,allowip2)functioncheckip(ip,allowip1,allowip2)dimcheck(4)checkip=falseipstr=split(ip,".")allow1=split(all
2、owip1,".")allow2=split(allowip2,".")ifcint(allow1(0))>cint(allow2(0))then''判断IP地址段是否合*response.write"禁止访问"exitfunctionendiffori=0toubound(ipstr)ifcint(allow1(i))3、llow2(i))thencheck(i)=truecheckip=trueexitforelseifcint(ipstr(i))>cint(allow2(i))thencheck(i)=falsecheckip=falseexitforelsecheck(i)=truecheckip=trueendifendifendifelseifcint(allow1(i))>cint(ipstr(i))orcint(allow1(i))ubound(ip4、str)thenexitforendifelsecheck(i)=trueendifendifnextif(check(0)=trueandcheck(1)=trueandcheck(2)=trueandcheck(3)=false)and(cint(allow2(2))>cint(ipstr(2)))thencheckip=trueendifendfunction%>
3、llow2(i))thencheck(i)=truecheckip=trueexitforelseifcint(ipstr(i))>cint(allow2(i))thencheck(i)=falsecheckip=falseexitforelsecheck(i)=truecheckip=trueendifendifendifelseifcint(allow1(i))>cint(ipstr(i))orcint(allow1(i))ubound(ip
4、str)thenexitforendifelsecheck(i)=trueendifendifnextif(check(0)=trueandcheck(1)=trueandcheck(2)=trueandcheck(3)=false)and(cint(allow2(2))>cint(ipstr(2)))thencheckip=trueendifendfunction%>
此文档下载收益归作者所有