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