Posted by ctiggerf on 02/23/07 14:19
On Feb 23, 12:49 am, Curtis <zer0d...@verizon.net> wrote:
> xhe wrote:
<snip>
>
> You should become best friends with Google for a while.
>
> --
> Curtis,http://dyersweb.com
/Agreed
But to answer your question (without reading the post that is) of how
to validate an ip address in php ...
<?php
$ip = '192.168.1';
if (($longip = ip2long($ip)) !== false) {
printf("%u<br>", $longip);
if ($ip == long2ip($longip)) {
echo "IP: $ip appears to be ok";
} else {
echo "$ip does not seem to match " .
long2ip($longip);
}
} else {
echo "IP appears to be invalid";
}
?>
For an explanation ...
http://www.jimgrill.com/pages/content/validateip
Which just happened to be the first result on Google for "valid ip
address php".
--Chris F.
[Back to original message]
|