Update updateComment-controller.php
This commit is contained in:
@@ -5,6 +5,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
require_once "php/model/CommentManager.php";
|
require_once "php/model/CommentManager.php";
|
||||||
|
require_once "includes/csrf.php";
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
@@ -16,6 +17,14 @@ if (!isset($_SESSION["user_email"])) {
|
|||||||
exit();
|
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(
|
$commentId = filter_input(
|
||||||
INPUT_POST,
|
INPUT_POST,
|
||||||
"comment_id",
|
"comment_id",
|
||||||
@@ -89,4 +98,4 @@ header(
|
|||||||
. urlencode((string) $articleId)
|
. urlencode((string) $articleId)
|
||||||
. "#comments"
|
. "#comments"
|
||||||
);
|
);
|
||||||
exit();
|
exit();
|
||||||
Reference in New Issue
Block a user