关于ip限制

我想通过request.ServerVariables("REMOTE_ADDR")来对浏览网页的用户的ip进行限制,但不知道该如何进行限制,比如我想设定只有 202.200.4.*的用户可以访问网页,该怎么写代码?
谢谢,在线等待!

---------------------------------------------------------------

if left(request.ServerVariables("REMOTE_ADDR"),9)="202.200.4" then
response.write "可以访问网页"
else
response.write "不可以访问网页"
end if
---------------------------------------------------------------

function Fn_IP(ip)
ip=cstr(ip)
ip1=left(ip,cint(instr(ip,".")-1))
ip=mid(ip,cint(instr(ip,".")+1))
ip2=left(ip,cint(instr(ip,".")-1))
ip=mid(ip,cint(instr(ip,".")+1))
ip3=left(ip,cint(instr(ip,".")-1))
ip4=mid(ip,cint(instr(ip,".")+1))
Fn_IP=cint(ip1)256256*256+cint(ip2)256256+cint(ip3)*256+cint(ip4)
end function

把ip地址转换成数字 把数字大于Fn_ip("202.200.4.0")小于Fn_ip("202.200.4.255")的ip通过

函数不知道能不能用,你试试看

Published At
Categories with Web编程
Tagged with
comments powered by Disqus