From 1e9705aa130a62e541e24b721afdd6493223a0ff Mon Sep 17 00:00:00 2001 From: Felix Ivo Date: Mon, 23 Jun 2025 14:19:04 +0200 Subject: [PATCH] fixed isAdmin --- Controller/NotesController.php | 6 +++--- Views/Notes/createNote.phtml | 2 +- Views/Notes/editNote.phtml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Controller/NotesController.php b/Controller/NotesController.php index 77c1190..9dfafc3 100644 --- a/Controller/NotesController.php +++ b/Controller/NotesController.php @@ -49,7 +49,7 @@ class NotesController if ($note) { // Redirect to show notes page after successful creation - header('Location: ?controller=NotesController&page=showNotes'); + header('Location: ?controller=Notes&page=showNotes'); exit(); } else { // If creation failed, show error message and stay on the form @@ -69,7 +69,7 @@ class NotesController if ($note) { // Redirect to show notes page after successful creation - header('Location: ?controller=NotesController&page=showNotes'); + header('Location: ?controller=Notes&page=showNotes'); exit(); } else { // If creation failed, show error message and stay on the form @@ -84,6 +84,6 @@ class NotesController { $noteId = $_GET['id']; $this->notesModel->deleteNote($noteId, $_SESSION['user_id']); - header("Location: ?controller=NotesController&page=showNotes"); + header("Location: ?controller=Notes&page=showNotes"); } } \ No newline at end of file diff --git a/Views/Notes/createNote.phtml b/Views/Notes/createNote.phtml index 82acc2d..3181cc9 100644 --- a/Views/Notes/createNote.phtml +++ b/Views/Notes/createNote.phtml @@ -23,7 +23,7 @@ function isLoggedIn() { } function isAdmin() { - return false;// isLoggedIn() && isset($_SESSION['role']) && $_SESSION['role'] === 'admin'; + return isLoggedIn() && isset($_SESSION['role']) && $_SESSION['role'] === 'admin'; } function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') { diff --git a/Views/Notes/editNote.phtml b/Views/Notes/editNote.phtml index dcc388a..2797213 100644 --- a/Views/Notes/editNote.phtml +++ b/Views/Notes/editNote.phtml @@ -23,7 +23,7 @@ function isLoggedIn() { } function isAdmin() { - return false;// isLoggedIn() && isset($_SESSION['role']) && $_SESSION['role'] === 'admin'; + return isLoggedIn() && isset($_SESSION['role']) && $_SESSION['role'] === 'admin'; } function sanitize($data, $flags = ENT_QUOTES, $encoding = 'UTF-8') {