note 38702 added to function.eregi
| From: | fusillo at NOSPAM dot netgang dot it | Date: | Sat, 03 Jan 2004 19:24:25 +0000 |
| Subject: | note 38702 added to function.eregi | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62876@lists.php.net to get a copy of this message | ||
This is a simple function that uses eregi() function to validate a domain name (according to the RFC
1034).
function check_host($host) {
if (
eregi("^[[:alpha:]]+([-[:digit:][:alpha:]]*
[[:digit:][:alpha:]])*(\.[[:alpha:]]+
([-[:digit:][:alpha:]]*[[:digit:][:alpha:]])*)
*$",$host)
) {
return 1;
} else return 0;
};
NOTE: This expression must be written on a single line to work
I had to brake it on separate lines to post on the site.
Returns 1 if $host is an RFC compliant domain name else returns 0.
This function is part of the code of blackboxed linux distribution coming on your screen late
genuary.
-fusillo-
----
Manual Page -- http://www.php.net/manual/en/function.eregi.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38702
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38702&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38702&report=yes
Search -- http://master.php.net/manage/user-notes.php