note 14606 added to function.ereg.php

From: Date: Mon, 06 Aug 2001 08:55:11 +0000
Subject: note 14606 added to function.ereg.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16367@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 http://www.php.net/manual/en/function.ereg.php

« previous php.notes (#16367) next »