note 14606 deleted from function.ereg by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 01:29:47 +0000 |
| Subject: | note 14606 deleted from function.ereg by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20156@lists.php.net to get a copy of this message | ||
hi,last time i put up code to valid ip. but i did small mistake.
here is corrected code.
hope it helps,
jd
function valid_ip($ip)
{
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 or $regs_array[4]
> 255 ) //last time, forgot to check fourth no.!!
return false; // if no. is > 255
}
else
return false; // if it is not having no.
return true;
} // end func