<%
'' 获取访问者的地址
ip = request.servervariables ("remote_addr")
'' 允许的 IP 地址段为 10.0.0.0 ~ 10.68.63.255
permitir1 = "10.0.0.0"
allowip2 = "10.68.10.71"
Response.Writecheckip (IP, Allowip1, Allowip2)
FunctionCheckip (IP, Allowip1, Allowip2)
Dimcheck (4)
checkip = false
ipstr = split (ip, ".")
ALIME1 = SPLIT (allowip1, ".")
permiss2 = split (allowip2, ".")
ifcint (allow1 (0))> cint (allow2 (0)) então '' 判断 ip 地址段是否合法
Response.Write "禁止访问"
saída de saída
endif
fori = 0Toubound (IPSTR)
ifcint (allow1 (i)) <cint (allow2 (i)) então
ifcint (allow1 (i)) = cint (ipstr (i)) então
Verifique (i) = true
checkip = true
exitfor
outro
ifcint (ipstr (i)) <cint (allow2 (i)) então
Verifique (i) = true
checkip = true
exitfor
outro
ifcint (ipstr (i))> cint (allow2 (i)) então
Verifique (i) = false
checkip = false
exitfor
outro
Verifique (i) = true
checkip = true
endif
endif
endif
outro
ifcint (allow1 (i))> cint (ipstr (i)) orcint (allow1 (i)) <cint (ipstr (i)) então
Verifique (i) = false
checkip = false
ifi <> ubound (ipstr) então
exitfor
endif
outro
Verifique (i) = true
endif
endif
próximo
if (check (0) = TrueArndCheck (1) = TrueArndCheck (2) = TrueArndCheck (3) = false) e (cint (allow2 (2))> cint (ipstr (2))) então
checkip = true
endif
Função final
%>