public function delAccount($smarty, $tpl, $params, $DB) { $home = new Home($DB); if (isset($_POST['btnDelete'])) { if (empty($_POST['account'])) { $smarty->assign('errDelete', "Veuillez renseigner un nom de compte."); $smarty->display('adminpage.tpl'); } else { $nomCompte = trim(htmlentities($_POST['account'], ENT_QUOTES)); $verifCompte = $home->verifCompte($nomCompte); if (!$verifCompte) { $smarty->assign('cpteInexistant', "Ce nom de compte n'existe pas en base de données."); $smarty->display('adminpage.tpl'); } else { $req = $home->delAccount($nomCompte); $smarty->assign('confirmDelete', "Le compte a bien été supprimé."); $smarty->display('adminpage.tpl'); } } } }