MDL-29551 Fixing ip_in_range function
authorPatrick Mcneill <pmcneill@berklee.com>
Thu, 10 Nov 2011 04:40:49 +0000 (10:10 +0530)
committerAnkit Kumar Agarwal <ankit_frenz@yahoo.co.in>
Wed, 16 Nov 2011 05:39:01 +0000 (11:09 +0530)
mnet/lib.php

index 060204c..94d4b86 100644 (file)
@@ -412,10 +412,10 @@ function ip_in_range($address, $network, $mask) {
    $lnetwork  = ip2long($network);
    $laddress  = ip2long($address);
 
-   $binnet    = str_pad( decbin($lnetwork),32,"0","STR_PAD_LEFT" );
+   $binnet    = str_pad( decbin($lnetwork), 32, "0", STR_PAD_LEFT );
    $firstpart = substr($binnet,0,$mask);
 
-   $binip     = str_pad( decbin($laddress),32,"0","STR_PAD_LEFT" );
+   $binip     = str_pad( decbin($laddress), 32, "0", STR_PAD_LEFT );
    $firstip   = substr($binip,0,$mask);
    return(strcmp($firstpart,$firstip)==0);
 }