예제 #1
0
파일: AjoutAdmin.php 프로젝트: sooheib/WEB
    }
    function AjouterAdmin($admin)
    {
        $Requete = "insert into utilisateur\n\t\t(nom,prenom,age,type,login,pwd)values\n\t\t(\n\t\t'" . $admin->getNom() . "',\n\t\t'" . $admin->getPrenom() . "',\n\t\t'" . $admin->getAge() . "',\n\t\t\t\t'admin',\n\t\t'" . $admin->login . "',\n\t\t\t\t'" . $admin->pwd . "'\n\t\t);";
        $this->conn->exec($Requete);
    }
    function verifPassword($pwd, $confirmpwd)
    {
        if ($pwd == $confirmpwd) {
            $success = true;
        } else {
            $success = false;
        }
        return $success;
    }
}
$login = $_POST['login'];
$pwd = $_POST['password'];
$confirmP = $_POST['conpassword'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$age = $_POST['age'];
$admin = new admin($nom, $prenom, $age, $login, $pwd);
$m = new AjoutAdmin();
$verifpwd = $m->verifPassword($pwd, $confirmP);
if ($verifpwd) {
    $m->AjouterAdmin($admin);
    header('location:authentification.html');
} else {
    echo "Password and Confirm password not match";
}