This commit is contained in:
Bruno Rybársky 2024-04-25 23:17:57 +02:00
parent 260789af82
commit 7a74b06fab

@ -9,11 +9,11 @@ function addMeme(string $title, string $memeText, int $imageID): array
if (isLoggedIn() && fileExists($imageID) && !empty($title) && !empty($memeText) && !empty($imageID) && $imageID > 0) { if (isLoggedIn() && fileExists($imageID) && !empty($title) && !empty($memeText) && !empty($imageID) && $imageID > 0) {
$stmtMemeAdd = $mysqli->prepare('INSERT INTO Memes (AuthorID, Title, TextContent, FileID) VALUES (?, ?, ?, ?)'); $stmtMemeAdd = $mysqli->prepare('INSERT INTO Memes (AuthorID, Title, TextContent, FileID) VALUES (?, ?, ?, ?)');
$stmtMemeAdd->bind_param('issi', $_SESSION['ID'], htmlspecialchars($title), htmlspecialchars($memeText), $imageID); $stmtMemeAdd->bind_param('issi', $_SESSION['ID'], htmlspecialchars($title), htmlspecialchars($memeText), $imageID);
echo $stmtMemeAdd->error;
if($stmtMemeAdd->execute() && $stmtMemeAdd->affected_rows > 0) { if($stmtMemeAdd->execute() && $stmtMemeAdd->affected_rows > 0) {
$output["Status"] = "Success"; $output["Status"] = "Success";
$output["Meme"] = "Funny"; $output["Meme"] = "Funny";
$output["Error"] = $stmtMemeAdd->error; $output["Error"] = $stmtMemeAdd->error;
echo "Hai";
} }
} }
return $output; return $output;