1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="commande.css" rel="stylesheet" type="text/css" />
<title>Commande en ligne</title>
</head>
<body>
<div id="princ">
<div class="descindex">Service de Commande en Ligne</div>
<hr id="hc"/>
<form action="" method="post" name="findex">
<div id="tid">Entrez votre numéro d'adhérent :</div><input type="password" id="identifiant" name="identifiant" maxlength="8" />
<input type="submit" value="Valider" name="valider" id="val" />
</form>
</div>
<?php
$cmpte=0;
if(isset($_POST['valider'])){
$idf=$_POST['identifiant'];
if (($idf=="")||(strlen($idf)<8)){
echo '<span class="erreur">Merci de saisir un identifiant de 8 caracteres</span>';
}else{
if($pf=fopen('com.txt','r')){
while(!feof($pf)){
$ligne=fgets($pf);
if(preg_match('`'.$idf.'`',$ligne)){
$cmpte++;
$tab=preg_split("/[#]/",$ligne);
}
}
echo $tab[0];
echo $tab[1];
fclose($pf);
if($cmpte==1){
//header('Location:commande.php?nom='.$tab[1]);
}else{header('Location:erreur.php');}
}else{
echo 'ouverture imposible';
}
}
}
?>
</body>
</html> |