From eb0a34e959595fead12f61a89713082429949400 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Wed, 17 Jun 2026 13:00:12 +0200 Subject: [PATCH] Create like-controller.php --- php/controller/like-controller.php | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 php/controller/like-controller.php diff --git a/php/controller/like-controller.php b/php/controller/like-controller.php new file mode 100644 index 0000000..d0d9a95 --- /dev/null +++ b/php/controller/like-controller.php @@ -0,0 +1,42 @@ +toggleLike($articleId, $userEmail); + + header("Location: ../../index.php?pfad=showArticle&id=" . $articleId); + exit(); + + } catch (NotFoundException $e) { + $_SESSION["message"] = "missing_id"; + header("Location: ../../index.php"); + exit(); + } catch (Exception $e) { + $_SESSION["message"] = "internal_error"; + header("Location: ../../index.php"); + exit(); + } +} else { + $_SESSION["message"] = "missing_id"; + header("Location: ../../index.php"); + exit(); +} + +?> \ No newline at end of file