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