Below is a quick example. This isn't the best way to do it, just
another way. I personally would convert them to integers then compare
instead of doing it the way I'm doing it below.

<?php

function privateIP($ip)
{
        if ( (($ip >= "10.0.0.0") && ($ip <= "10.255.255.255")) ||
             (($ip >= "192.168.0.0")  && ($ip <= "192.168.255.255")) ||
             (($ip >= "172.16.0.0") && ($ip <= "172.31.255.255")) ) {
                return true;
        }
        return false;
}

if (privateIP("192.168.1.1")) {
        print "hmm";
}
?>

William Betts
http://www.phpbakery.com

On Nov 26, 2007 6:08 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Ronald, I really dont care if my email doesn't reach you, making normal 
> people jump
> through hoops because you want to avoid spam is not the right way to do 
> things,
> next time I'll remember not to answer your questions as your not going to
> ['be able to'] read my answers:
>
> <BLA BLA BLA>
> This message was created automatically by mail delivery software (TMDA).
>
> Your message attached below is being held because the address
> <[EMAIL PROTECTED]> has not been verified.
>
> To release your message for delivery, please send an empty message
> to the following address, or use your mailer's "Reply" feature.
>
>    [EMAIL PROTECTED]
>
> This confirmation verifies that your message is legitimate and not
> junk-mail. You should only have to confirm your address once.
>
> If you do not respond to this confirmation request within 14 days,
> your message will not be delivered.
> </BLA BLA BLA>
>
>
>
> Jochem Maas wrote:
> > Ronald Wiplinger wrote:
> >> I use $aa=$_SERVER["REMOTE_ADDR"];
> >>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to