note 14477 added to function.ereg.php
| From: | boyzone_2001NOSPAM at yahoo dot com | Date: | Wed, 01 Aug 2001 17:02:22 +0000 |
| Subject: | note 14477 added to function.ereg.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16180@lists.php.net to get a copy of this message | ||
this is a function which will check for the validity of ip. this is a complete check compare to the
previous code in the same comments ..
hope it helps,
jd
function valid_ip($ip)
{
//yet to add code.
if( ereg("^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$", $ip,$regs_array) )
{
// if it is having no.
if($regs_array[1] > 255 or $regs_array[2] > 255 or $regs_array[3] > 255 )
return false; // if no. is > 255
}
else
return false; // if it is not having no.
return true;
} // end func
http://www.php.net/manual/en/function.ereg.php