| Current File : /home/digitaw/Ycof/admin/addclient.php |
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
require'configuration.php';
$nom=$_POST['nom'];
$prenom=$_POST['prenom'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$username=$_POST['username'];
$passwd=$_POST['password'];
$passwdcrype=sha1($_POST['password']);
$messageErreur='';
$messageSuccess='';
do{
$requete="SELECT * FROM utilisateurs WHERE username='$username' OR email='$email'";
$verification = $connection->query($requete);
if($verification->num_rows>0){
$msg = "ce compte existe déja !";
$_SESSION['msg'] = "<div class='alert alert-danger alert-dismissible fade show ' role='alert'>
<i class='bi bi-check-circle ml-5' style='font-size:25px;'></i>
<strong style='font-size:17px;'>$msg</strong>
<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
</div>";
header("Location: clients.php");
}
else{
//insertion
$requete="INSERT INTO utilisateurs(nom,prenom,email,phone,username,passwd) VALUES('$nom','$prenom','$email','$phone','$username','$passwdcrype')";
$verification = $connection->query($requete);
if($verification){
$msg = "Inscription reussie !";
$_SESSION['msg'] = "<div class='alert alert-success alert-dismissible fade show ' role='alert'>
<i class='bi bi-check-circle ml-5' style='font-size:25px;'></i>
<strong style='font-size:17px;'>$msg</strong>
<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
</div>";
header("Location: clients.php");
}
}
}while(false);
}
?>