From dbfea88177d1afb24fbd86bab9fbe396191fc51c Mon Sep 17 00:00:00 2001 From: bruno Date: Fri, 26 Apr 2024 10:52:11 +0200 Subject: [PATCH] Fix --- lib/meme.php | 6 +++--- lib/upload.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/meme.php b/lib/meme.php index 02fba2a..239ad9b 100644 --- a/lib/meme.php +++ b/lib/meme.php @@ -71,10 +71,10 @@ function deleteMeme(int $memeId): array global $mysqli; $out = ["Status" => "Fail"]; if (isLoggedIn()) { - $query = !isAdmin() ? 'DELETE FROM Memes WHERE ID = ? AND AuthorID = ?' : 'DELETE FROM Memes WHERE ID = ?'; + $query = !isModerator() ? 'DELETE FROM Memes WHERE ID = ? AND AuthorID = ?' : 'DELETE FROM Memes WHERE ID = ?'; $stmtDelete = $mysqli->prepare($query); - if (!isAdmin()) { - $stmtDelete->bind_param('ii', $memeId, $_SESSION['id']); + if (!isModerator()) { + $stmtDelete->bind_param('ii', $memeId, $_SESSION['ID']); } else { $stmtDelete->bind_param('i', $memeId); } diff --git a/lib/upload.php b/lib/upload.php index d632504..ab24c6a 100644 --- a/lib/upload.php +++ b/lib/upload.php @@ -210,12 +210,12 @@ function addToGroup(int $groupId, int $fileId): array } global $mysqli; $stmtcheck = $mysqli->prepare('SELECT ID FROM FileGroups WHERE CreatorID != ? AND ID = ?'); - $stmtcheck->bind_param('ii', $_SESSION['id'], $groupId); + $stmtcheck->bind_param('ii', $_SESSION['ID'], $groupId); $stmtcheck->execute(); if ($stmtcheck->affected_rows == 0) { if (fileExists($fileId, false)) { $stmtadd = $mysqli->prepare('INSERT INTO FileGroups (FileID, CreatorID, ID) VALUES (?, ?, ?)'); - $stmtadd->bind_param('iii', $fileId, $_SESSION['id'], $groupId); + $stmtadd->bind_param('iii', $fileId, $_SESSION['ID'], $groupId); $stmtadd->execute(); if ($stmtadd->affected_rows > 0) { $output["Status"] = "Success"; @@ -247,7 +247,7 @@ function deleteFile(int $fileID): string $query = !isAdmin() ? 'DELETE FROM Files WHERE ID = ? AND UploadedBy = ?' : 'DELETE FROM Files WHERE ID = ?'; $stmtDelete = $mysqli->prepare($query); if (!isAdmin()) { - $stmtDelete->bind_param('ii', $fileID, $_SESSION['id']); + $stmtDelete->bind_param('ii', $fileID, $_SESSION['ID']); } else { $stmtDelete->bind_param('i', $fileID); }