This commit is contained in:
Bruno Rybársky 2024-04-25 22:53:14 +02:00
parent 16f9dedce2
commit 99d4f076f9

@ -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