note 14477 deleted from function.ereg by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 01:28:40 +0000 |
| Subject: | note 14477 deleted from function.ereg by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20153@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