note 42585 rejected from function.ereg by nlopess
| From: | nlopess@php.net | Date: | Sat, 22 May 2004 08:21:57 +0000 |
| Subject: | note 42585 rejected from function.ereg by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69945@lists.php.net to get a copy of this message | ||
Note Submitter: alexandrebarboza@globo.com
----
mabe somebody can help me with this pattern...
<?
function check_host($host) {
if (ereg("^http://([a-z0-9]{2,}\.[_a-z0-9-])+", $host)) {
return true;
} else {
return false;
}
}
if (isset($_POST['host'])) {
if (check_host($_POST['host'])) {
echo "Valid URL...";
} else {
echo "Invalid URL...";
}
}
echo '<form name="FormPost" action="'.$_SERVER[PHP_SELF].'"
method="post">';
echo '<input type="text" name="host" size="40"
maxlength="256">';
echo '<input type="submit" value="Go!">';
echo '</form>';
?>