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
| <?php
if(isset($_POST['submit']))
{
echo "STEP 1 OK<br>";
$id = htmlentities(trim($_POST['id']));
$nom = htmlentities(trim($_POST['nom']));
$prenom = htmlentities(trim($_POST['prenom']));
$fonction = htmlentities(trim($_POST['fonction']));
$service = htmlentities(trim($_POST['service']));
$pseudo = htmlentities(trim($_POST['pseudo']));
$password = htmlentities(trim($_POST['password']));
$repassword = htmlentities(trim($_POST['repassword']));
if (($id<>'') AND ($nom<>'') AND ($prenom<>'') AND ($fonction<>'') AND ($service<>'') AND ($pseudo<>'') AND ($password<>'') AND ($repassword<>''))
{
echo "STEP 2 OK<br>";
if($password==$repassword)
{
echo "STEP 3 OK<br>";
if (strlen($password)>4)
{
echo "STEP 4 OK<br>";
$pass_hache = sha1('gz'.$_POST['password']);
$connect = mysql_connect('localhost', 'root', 'bnetd') or die ('Impossible de se connnecter à la Base de Données');
$mabd = mysql_select_db('biblio');
$reg = mysql_query ("SELECT * FROM agent WHERE pseudo='$pseudo' AND password='$password'");
$psan = mysql_num_rows($reg);
if($psan==0)
{
echo "STEP 4 OK<br>";
mysql_query ("INSERT INTO agent (id,nom,prenom,fonction,service,pseudo,password) VALUES ('$id', '$nom', '$prenom', '$fonction', '$service', '$pseudo', '$password')");
die ("Les données saisies ont été bien enregistrées. <a href='enregistrement_.php'> <strong> Nouvel Enregistrement </strong> </a>");
} else echo "Ce pseudo est déjà utilisé.";
}else echo "Le mot de passe est trop court. Veuillez saisir un mot de passe de plus de quatre (04) carartères. ";
}else echo "Les deux mots de passe doivent être identiques.";
}else echo "Veuillez renseigner tous les champs";
}
?> |
Partager