Fix
This commit is contained in:
parent
496d381ace
commit
dbfea88177
@ -71,10 +71,10 @@ function deleteMeme(int $memeId): array
|
|||||||
global $mysqli;
|
global $mysqli;
|
||||||
$out = ["Status" => "Fail"];
|
$out = ["Status" => "Fail"];
|
||||||
if (isLoggedIn()) {
|
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);
|
$stmtDelete = $mysqli->prepare($query);
|
||||||
if (!isAdmin()) {
|
if (!isModerator()) {
|
||||||
$stmtDelete->bind_param('ii', $memeId, $_SESSION['id']);
|
$stmtDelete->bind_param('ii', $memeId, $_SESSION['ID']);
|
||||||
} else {
|
} else {
|
||||||
$stmtDelete->bind_param('i', $memeId);
|
$stmtDelete->bind_param('i', $memeId);
|
||||||
}
|
}
|
||||||
|
@ -210,12 +210,12 @@ function addToGroup(int $groupId, int $fileId): array
|
|||||||
}
|
}
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
$stmtcheck = $mysqli->prepare('SELECT ID FROM FileGroups WHERE CreatorID != ? AND ID = ?');
|
$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();
|
$stmtcheck->execute();
|
||||||
if ($stmtcheck->affected_rows == 0) {
|
if ($stmtcheck->affected_rows == 0) {
|
||||||
if (fileExists($fileId, false)) {
|
if (fileExists($fileId, false)) {
|
||||||
$stmtadd = $mysqli->prepare('INSERT INTO FileGroups (FileID, CreatorID, ID) VALUES (?, ?, ?)');
|
$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();
|
$stmtadd->execute();
|
||||||
if ($stmtadd->affected_rows > 0) {
|
if ($stmtadd->affected_rows > 0) {
|
||||||
$output["Status"] = "Success";
|
$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 = ?';
|
$query = !isAdmin() ? 'DELETE FROM Files WHERE ID = ? AND UploadedBy = ?' : 'DELETE FROM Files WHERE ID = ?';
|
||||||
$stmtDelete = $mysqli->prepare($query);
|
$stmtDelete = $mysqli->prepare($query);
|
||||||
if (!isAdmin()) {
|
if (!isAdmin()) {
|
||||||
$stmtDelete->bind_param('ii', $fileID, $_SESSION['id']);
|
$stmtDelete->bind_param('ii', $fileID, $_SESSION['ID']);
|
||||||
} else {
|
} else {
|
||||||
$stmtDelete->bind_param('i', $fileID);
|
$stmtDelete->bind_param('i', $fileID);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user