This commit is contained in:
Bruno Rybársky 2024-04-25 23:19:30 +02:00
parent c159b0b749
commit e7f177e4cc

@ -7,13 +7,13 @@ function addMeme(string $title, string $memeText, int $imageID): array
global $mysqli; global $mysqli;
$output = ["Status" => "Fail"]; $output = ["Status" => "Fail"];
echo "B"; echo "B";
if (isLoggedIn() && fileExists($imageID) && !empty($title) && !empty($memeText) && !empty($imageID) && $imageID > 0) {
echo isLoggedIn(); echo isLoggedIn();
echo fileExists($imageID); echo fileExists($imageID);
echo !empty($title); echo !empty($title);
echo !empty($memeText); echo !empty($memeText);
echo !empty($imageID); echo !empty($imageID);
echo $imageID > 0; echo $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);
if($stmtMemeAdd->execute() && $stmtMemeAdd->affected_rows > 0) { if($stmtMemeAdd->execute() && $stmtMemeAdd->affected_rows > 0) {