<%
function IpToNumber(ip)'IP地址转为数字
arr=split(ip,".")
IpToNumber=256*256*256*clng(arr(0))+256*256*clng(arr(1))+256*clng(arr(2))+clng(arr(3))
end function
function IsPrivateIp(ip)'判断给定的IP地址是否内网/私有ip地址
if instr(ip,"127.")=1 then'回环IP地址
IsPrivateIp=true:exit function
end if
ABegin=IpToNumber("10.0.0.0"):AEnd=IpToNumber("10.255.255.255")'A类私有IP地址
BBegin=IpToNumber("172.16.0.0"):BEnd=IpToNumber("172.31.255.255")'B类私有IP地址
CBegin=IpToNumber("192.168.0.0"):CEnd=IpToNumber("192.168.255.255")'C类私有IP地址
IpNum=IpToNumber(ip)
IsPrivateIp=(ABegin<=IpNum and IpNum<=AEnd) or (BBegin<=IpNum and IpNum<=BEnd) or (CBegin<=IpNum and IpNum<=CEnd)
end function
Response.Write IsPrivateIp("11.255.255.255")&"<br>"'false
Response.Write IsPrivateIp("182.255.255.255")&"<br>"'false
Response.Write IsPrivateIp("172.30.255.255")&"<br>"'true
Response.Write IsPrivateIp("192.168.205.2")&"<br>"'true
Response.Write IsPrivateIp("127.168.205.2")'true
%>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有