note 55254 added to ref.network
| From: | metator at netcabo dot pt | Date: | Thu, 28 Jul 2005 14:34:45 +0000 |
| Subject: | note 55254 added to ref.network | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92650@lists.php.net to get a copy of this message | ||
Ups. The function has a bug, though the example still works with it. Just replace the $_POST
variables by the function parameters.
<?
function isIPIn($ip, $net, $mask) {
//doesn't check for the return value of ip2long
$ip = ip2long($ip);
$rede = ip2long($net);
$mask = ip2long($mask);
//AND
$res = $ip & $mask;
return ($res == $rede);
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.network.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55254
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55254&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55254&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55254&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55254&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55254&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55254&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55254&report=yes
Search -- http://master.php.net/manage/user-notes.php