Update createArticle-controller.php

This commit is contained in:
2026-06-01 23:33:20 +02:00
parent 5703c0a6dd
commit da9ea4f413
+13 -13
View File
@@ -13,20 +13,8 @@ if (!isset($_SESSION["user"])) {
try {
$user = $dao->findUser($_SESSION["user_email"] ?? "");
} catch (Exception $e) {
$_SESSION["message"] = "internal_error";
exit();
}
if (!$user) {
$_SESSION = [];
session_destroy();
header("Location: ../../index.php?pfad=login");
exit();
}
if ($_SERVER["REQUEST_METHOD"] === "POST") {
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$_SESSION["old_title"] = $_POST["title"] ?? '';
$_SESSION["old_content"] = $_POST["content"] ?? '';
$_SESSION["old_category"] = $_POST["category"] ?? '';
@@ -103,6 +91,18 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
header("location: ../../index.php");
exit();
}
}
} catch (Exception $e) {
$_SESSION["message"] = "internal_error";
exit();
}
if (!$user) {
$_SESSION = [];
session_destroy();
header("Location: ../../index.php?pfad=login");
exit();
}
?>