dev auf main #68
@@ -4,6 +4,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||
}
|
||||
|
||||
require_once __DIR__ . "/../model/ArticleManager.php";
|
||||
require_once __DIR__ . "/../../includes/csrf.php";
|
||||
|
||||
if (!isset($_SESSION["user"])) {
|
||||
header("Location: index.php?pfad=login");
|
||||
@@ -12,6 +13,13 @@ if (!isset($_SESSION["user"])) {
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
|
||||
// CSRF-Token prüfen, bevor irgendeine Änderung vorgenommen wird
|
||||
if (!csrf_verify()) {
|
||||
$_SESSION["message"] = "invalid_csrf_token";
|
||||
header("location: ../../index.php?pfad=profile");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_SESSION["user_email"])) {
|
||||
$user = $_SESSION["user_email"];
|
||||
} else {
|
||||
@@ -22,9 +30,10 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_POST["id"]) && !empty($_POST["id"])) {
|
||||
$id = $_POST["id"];
|
||||
} else {
|
||||
// Die Beitrags-ID muss eine gültige numerische ID sein.
|
||||
$id = filter_input(INPUT_POST, "id", FILTER_VALIDATE_INT);
|
||||
|
||||
if ($id === false || $id === null) {
|
||||
$_SESSION["message"] = "missing_id";
|
||||
header("location: ../../index.php?pfad=profile");
|
||||
exit();
|
||||
@@ -44,4 +53,4 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$_SESSION["message"] = "article_deleted";
|
||||
header("location: ../../index.php?pfad=profile");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user