note 89935 deleted from function.ip2long by thiago

From: Date: Mon, 30 Mar 2009 12:33:16 +0000
Subject: note 89935 deleted from function.ip2long by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152612@lists.php.net to get a copy of this message
Note Submitter: Robert ---- to kaputt at starnet dot md @ 04-Nov-2008 09:47 Your code is WRONG! for example: 10.0.0.0/8 $net_addr=decbin(myip2long('10.0.0.0')); -> 1010 00000000 00000000 00000000 in next step: substr($net_addr, 0, 8) -> 10100000 but real value must be: 00001010 as result your function '10.255.1.1' not mached by '10.0.0.0/8' you must add some '0' in left part of binary IP to reach strlen($net_addr)==32

« previous php.notes (#152612) next »