From 50b29c96d6c0a6fe124a6135f6525089c8bc3cb3 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Sun, 19 Jul 2026 16:01:06 +0200 Subject: [PATCH] Update updateComment-controller.php --- php/controller/updateComment-controller.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/php/controller/updateComment-controller.php b/php/controller/updateComment-controller.php index e215911..2182f22 100644 --- a/php/controller/updateComment-controller.php +++ b/php/controller/updateComment-controller.php @@ -5,6 +5,7 @@ if (session_status() === PHP_SESSION_NONE) { } require_once "php/model/CommentManager.php"; +require_once "includes/csrf.php"; if ($_SERVER["REQUEST_METHOD"] !== "POST") { header("Location: index.php"); @@ -16,6 +17,14 @@ if (!isset($_SESSION["user_email"])) { exit(); } +// CSRF-Token prüfen, bevor irgendeine Änderung vorgenommen wird +if (!csrf_verify()) { + $_SESSION["comment_message"] = "Deine Sitzung ist abgelaufen. Bitte lade die Seite neu."; + $_SESSION["comment_message_type"] = "error"; + header("Location: index.php"); + exit(); +} + $commentId = filter_input( INPUT_POST, "comment_id", @@ -89,4 +98,4 @@ header( . urlencode((string) $articleId) . "#comments" ); -exit(); +exit(); \ No newline at end of file