From 560f53cfb6f19a1ff0b370eac9efb1595c852d01 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:24:51 +0200 Subject: [PATCH] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index f1b7a45..19d2c2a 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -5,14 +5,17 @@ require_once '../model/ArticleManager.php'; require_once '../model/Article.php'; if ($_SERVER["REQUEST_METHOD"] === "POST") { - if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ + try { + $id = $_GET["id"]; + } catch (Exception $e){ + $_SESSION["message"] = "missing_id"; + } + if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ $_SESSION["message"] = "missing_parameters"; header("location: ../../index.php?pfad=updateArticle"); - exit(); } elseif(!isset($id)) { $_SESSION["message"] = "missing_id"; header("location: ../../index.php?pfad=updateArticle"); - exit(); }else{ $newTitle = $_POST["title"]; @@ -35,9 +38,9 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $_SESSION["message"] = "article_updated"; // Weiterleitung zur Homepage header("location: ../../index.php"); - exit(); } + exit(); } ?> \ No newline at end of file