This commit is contained in:
Bruno Rybársky 2024-04-25 23:38:13 +02:00
parent afbeff1b08
commit 5cee6d3044

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