Update createArticle-controller.php
This commit is contained in:
@@ -13,20 +13,8 @@ if (!isset($_SESSION["user"])) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
$user = $dao->findUser($_SESSION["user_email"] ?? "");
|
||||||
} catch (Exception $e) {
|
|
||||||
$_SESSION["message"] = "internal_error";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$user) {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$_SESSION = [];
|
|
||||||
session_destroy();
|
|
||||||
|
|
||||||
header("Location: ../../index.php?pfad=login");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|
||||||
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
||||||
$_SESSION["old_content"] = $_POST["content"] ?? '';
|
$_SESSION["old_content"] = $_POST["content"] ?? '';
|
||||||
$_SESSION["old_category"] = $_POST["category"] ?? '';
|
$_SESSION["old_category"] = $_POST["category"] ?? '';
|
||||||
@@ -103,6 +91,18 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
header("location: ../../index.php");
|
header("location: ../../index.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$_SESSION["message"] = "internal_error";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
$_SESSION = [];
|
||||||
|
session_destroy();
|
||||||
|
|
||||||
|
header("Location: ../../index.php?pfad=login");
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user