From 99d4f076f935ff5445ce1a2b7b3aada3ab4a4035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Thu, 25 Apr 2024 22:53:14 +0200 Subject: [PATCH] MEME --- lib/meme.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/meme.php b/lib/meme.php index 8da95e1..c649a08 100644 --- a/lib/meme.php +++ b/lib/meme.php @@ -2,17 +2,17 @@ require_once "lib/upload.php"; -function addMeme(string $title, string $memeText, int $imageID): bool +function addMeme(string $title, string $memeText, int $imageID): array { global $mysqli; - + $output = ["Status" => "Fail"]; if (isLoggedIn() && fileExists($imageID)) { $stmtMemeAdd = $mysqli->prepare('INSERT INTO Memes (AuthorID, Title, TextContent, FileID) VALUES (?, ?, ?, ?)'); $stmtMemeAdd->bind_param('issi', $_SESSION['ID'], htmlspecialchars($title), htmlspecialchars($memeText), $imageID); $stmtMemeAdd->execute(); - return true; + $output["Status"] = "Success"; } - return false; + return $output; } function renderMeme(string $title, string $textContent, string $createdAt, string $filePath, string $userNickname): string