RE: [PHP] I.P. range authentication
| From: | John W. Holmes | Date: | Wed, 19 Mar 2003 01:51:07 +0000 |
| Subject: | RE: [PHP] I.P. range authentication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140232@lists.php.net to get a copy of this message | ||
> $abytes = explode('.', $ip); // explode the IP string
> $ip = 0;
> foreach ($abytes as $byte) $ip = ($ip << 8) + $byte;
>
> This will give you the valid numeric equivalent of the IP address.
Isn't that what ip2long() does?
Also, the man page on ip2long() has some good notes and code that may
help the OP.
http://www.php.net/manual/en/function.ip2long.php
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/