note 13521 added to function.ereg.php
| From: | franck at gerbille dot net | Date: | Wed, 20 Jun 2001 09:14:28 +0000 |
| Subject: | note 13521 added to function.ereg.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14481@lists.php.net to get a copy of this message | ||
This is a script for validade a licence ex : 1d2e3g-5d5f6g-e98r56
The first page must be a form with 3 field : $codea $codeb and $codec
ANd this is the magic script :)
<?
$enabler_code = "$codea-$codeb-$codec";
if ($codea == "" || $codeb == "" || $codec == "") {
echo "$error $typa Enabler Code - You must be have 6 caracters by field !$type<BR> <a
href=javascript:history.go(-1)>$erreur</A>";}
else {
if ($enabler_code == "$word" ) {
echo "$error $typa Old Enabler Code is the same of the New Enabler Code$type<BR> <a
href=javascript:history.go(-1)>$erreur</A>";}
else {
if (!eregi("^[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]$", $codea)) {
echo "You are do an error in the first field : $codea ";
} else {
if (!eregi("^[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]$", $codeb)) {
echo "You are do an error in the first field : $codeb ";
} else {
if (!eregi("^[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]$", $codec)) {
echo "You are do an error in the first field : $codec ";
} else {
echo("VALID !");
}
}
}
?>
Franck from www.gerbille.net
http://www.php.net/manual/fr/function.ereg.php