user delete account

This commit is contained in:
Illia Hromovoi 2025-07-03 12:19:19 +02:00
parent bdc491fbfa
commit c94c7f9b45
5 changed files with 33 additions and 6 deletions

View File

@ -11,6 +11,7 @@
max-width: 90%;
padding: 24px 42px 24px 42px;
margin: 0 auto;
color: var(--brand-white);
}
.row {

View File

@ -167,4 +167,9 @@ class UserController{
public function showUserAccountPage (){
}
public function deleteUser(){
$userId = $_SESSION["user_id"];
$this->db->deleteUser($userId);
}
}

View File

@ -59,4 +59,12 @@ class UserModel extends Database
return $sth->fetch();
}
public function deleteUser($id){
$pdo = $this->linkDB();
$sql = "DELECT * FROM user WHERE id = :id";
$sth = $pdo->prepare($sql);
$sth->execute([":id" => $id]);
return $sth->fetch();
}
}

View File

@ -6,11 +6,23 @@
<div class="container">
<div class="row">
<div class="col-12">
<h1>Hallo,
<?php echo ($_SESSION['vorname'] ?? "") . " " . ($_SESSION['name'] ?? "") ?>
</br>
Hier können Sie ihren Account verwalten.
</h1>
<div class="row">
<form method="post">
<input type="hidden" name="controller" value="user">
<input type="hidden" name="do" value="logout">
<button type="submit" class="btn btn-logout">Ausloggen</button>
</form>
<form method="post">
<input type="hidden" name="controller" value="user">
<input type="hidden" name="do" value="deleteAccount">
<button type="submit" class="btn btn-logout">Meinen Account löschen</button>
</form>
</div>
</div>
</div>
</div>

View File

@ -43,4 +43,5 @@
</div>
</nav>
</header>
<main>
<!-- TODO Transparent mit Fehleranzeige bei der Anmeldung -->
<main style="color: transparent">