How does PHP implement ip2cidr (generate multiple cidr)? are there any functions that generate multiple cidr, for example, 1.120.0.0 1.159.255.255 to generate 1.120.0.0/13 1.128.0.0/11?
Reply to discussion (solution)
Function ip2cidr ($
Do you have a great God? There are no functions that generate more than one CIDR, such as 1.120.0.0 1.159.255.255 generate 1.120.0.0/13 1.128.0.0/11
Reply to discussion (solution)
function Ip2cidr ($ip _start, $ip _end) {if (Long2ip (Ip2long (
The network environment is very complex. Sometimes we have to prohibit access by some malicious users. There are many ways to prohibit access, one of which is through IP address restrictions, the method provided in this article allows you to check
You can add a configuration file by adding a certain number of IP addresses that need to be banned to the configuration file, read each rule in the configuration file at the time of program initialization, and then use the method provided in this
PHP checks or filters out the implementation code of IP addresses. You can add some IP addresses that need to be disabled to the configuration file by adding a configuration file with certain rules. during program initialization, to read each IP
The network environment is very complex. sometimes we have to prohibit access by some malicious users. There are many ways to prohibit access, one of which is through IP address restrictions, the method provided in this article allows you to add a
You can add a configuration file by adding a certain number of IP addresses that need to be banned to the configuration file, read each rule in the configuration file at the time of program initialization, and then use the method provided in this
The Ip2long IP address is converted to an integer type.Long2ip integer data is converted to IP. The subnet mask is converted to a mask length mode:$slash _notation = strlen (Preg_replace ("/0/", "", Decbin (Ip2long ($subnet _mask)));$bits =strpos
You can add a configuration file, then add some IP addresses that need to be banned through a set of rules to the configuration file, read each rule in the configuration file when the program is initialized, and then check to see if the current
You can add some IP addresses that need to be banned to the configuration file by adding a configuration file with certain rules, and read each rule in the configuration file during program initialization, then, use the methods provided in this
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.