Re: note 37570 rejected and deleted from function.ereg by notes editor pollita
| From: | Michal "ok0n" Kubski | Date: | Thu, 20 Nov 2003 06:37:19 +0000 |
| Subject: | Re: note 37570 rejected and deleted from function.ereg by notes editor pollita | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-22119@lists.php.net to get a copy of this message | ||
On 20 Nov 2003 00:39:33 -0000
webmaster@php.net wrote:
[...cut...]
>
> Your note has been removed from the on-line manual.
>
Well, could you please tell me the reason?
It is not a bug report, nor feature request, nor a question,
nor e-mail address validator ;-)
> ----- Copy of your note below -----
>
> The easier way to validate IPv4 and ethernet hardware address (MAC):
>
> function is_macaddress($mac)
> {
> if ( !eregi("^[0-9a-f]{2}(:[0-9a-f]{2}){5}$", $mac)) {
> return FALSE;
> }
> return TRUE;
> }
>
> function is_ipv4address($addr)
> {
>
> if ( !ereg("^([0-9]{1,3}(\.[0-9]{1,3}){3})$", $addr)) {
> return FALSE;
> }
>
> foreach (explode(".", $addr) as $a) {
> if (($a < 0) || ($a > 255)) {
> return FALSE;
> }
> }
>
> return TRUE;
> }
>
> have fun,
> okon.
>
> PS. beware - in real world there are no such IPv4 addresses as 0.0.0.0 or 255.255.255.255 which
> is_ipv4address() would validate successfuly!
>
--
>><{]'> http://okon.one.pl/
<'[}><<
"I feel something falling from the sky
I'm so sad I made the angels cry"
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]