note 51683 deleted from function.preg-match by colder

From: Date: Mon, 18 Jun 2007 18:21:29 +0000
Subject: note 51683 deleted from function.preg-match by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127594@lists.php.net to get a copy of this message
Note Submitter: max at clnet dot cz ---- satch666 writed fix for the function valid_ipv4(), but it's not working good. I think that this code is realy functionaly. <? $num="([0-9]|[0-9]{2}|1\d\d|2[0-4]\d|25[0-5])"; /* [0-9] => numbers 0-9 [0-9]{2} => numbers 0-99 --> This is missing in satch666 code. It means, that if you write IP 25.213.110.1 function return FALSE! 1\d\d => numbers 100-199 2[0-4]\d => numbers 200-249 25[0-5] => numbers 250-255 */ if (!preg_match("/^$num\.$num\.$num\.$num$/", $$ip_addr)) echo "Wrong IP Address\n"; ?>

« previous php.notes (#127594) next »