note 104652 deleted from ref.network by danbrown
| From: | danbrown@php.net | Date: | Tue, 28 Jun 2011 20:26:04 +0000 |
| Subject: | note 104652 deleted from ref.network by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181024@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Here is an updated version of claudiu function...
<?php
function ipCIDRCheck ($ip, $cidr) {
list ($net, $mask) = explode('/', $cidr);
$ipnet = ip2long($ip) & ~((1 << (32 - $mask)) - 1);
return ($ipnet === ip2long($net));
}
?>