asp 는 ip 주소 가 내부 네트워크 나 개인 ip 주소 의 코드 공유 인지 확인 합 니 다.
내부 네트워크/개인 IP 주소 네트워크 는 다음 과 같 고 127 로 시작 하 는 순환 주소 도 있 습 니 다.
10.0.0.0-10.255.255.255
172.16.0.0―172.31.255.255
192.168.0.0-192.168.255.255
구현 코드:
<%
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
%>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Shadows: Spooktober in Answer Set ProgrammingASP can be viewed as an extension of Prolog. Pure Prolog rules are based on definite clauses, that is Horn clauses which...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.