Funktionalität fürs Löschen des Accounts
This commit is contained in:
parent
b0c1ddae2a
commit
a0416cdefe
@ -147,7 +147,7 @@ class UserController{
|
||||
}
|
||||
|
||||
public function clearUserSession(){
|
||||
unset($_SESSION["user_id"], $_SESSION["user_role"]);
|
||||
unset($_SESSION["user_id"], $_SESSION["user_role"], $_SESSION["vorname"], $_SESSION["name"]);
|
||||
}
|
||||
|
||||
public function logout(){
|
||||
@ -168,8 +168,18 @@ class UserController{
|
||||
|
||||
}
|
||||
|
||||
public function deleteUser(){
|
||||
$userId = $_SESSION["user_id"];
|
||||
$this->db->deleteUser($userId);
|
||||
public function showUserDeleteConfirmation(){
|
||||
|
||||
}
|
||||
|
||||
public function deleteAccount(){
|
||||
$userId = $_SESSION["user_id"] ?? "";
|
||||
if($userId){
|
||||
$this->db->deleteUser($userId);
|
||||
$this->clearUserSession();
|
||||
$this->view->setDoMethodName("showUserDeleteConfirmation");
|
||||
$this->showUserDeleteConfirmation();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -61,10 +61,12 @@ class UserModel extends Database
|
||||
|
||||
public function deleteUser($id){
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "DELECT * FROM user WHERE id = :id";
|
||||
$sql = "DELETE FROM user WHERE id = :id";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([":id" => $id]);
|
||||
return $sth->fetch();
|
||||
$sth->bindParam(":id", $id);
|
||||
$sth->execute();
|
||||
$sth->execute();
|
||||
// echo "Benutzer ist gelöscht";
|
||||
}
|
||||
|
||||
}
|
14
Views/User/showUserDeleteConfirmation.phtml
Normal file
14
Views/User/showUserDeleteConfirmation.phtml
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1>Der Account wurde erfolgreich gelöscht</h1>
|
||||
<div class="row">
|
||||
<a class="btn btn-primary" href="index.php">Unsere Kurse ansehen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user