From fa5ae71cef052e52fdf4b46671c918fddb4539ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Thu, 25 Apr 2024 23:31:41 +0200 Subject: [PATCH] MEME --- lib/upload.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/upload.php b/lib/upload.php index 1fa759b..f1b6590 100644 --- a/lib/upload.php +++ b/lib/upload.php @@ -183,7 +183,7 @@ function fileExists(int $fileId, bool $onlyMine = true): bool|string if (!$onlyMine && !isAdmin()) { $onlyMine = true; } - $query = $onlyMine ? 'SELECT Path FROM Files WHERE ID = ? AND UploadedBy = ?' : 'SELECT Path FROM Files WHERE ID = ?'; + $query = $onlyMine ? 'SELECT ID, Path FROM Files WHERE ID = ? AND UploadedBy = ?' : 'SELECT Path FROM Files WHERE ID = ?'; $stmtfileexists = $mysqli->prepare($query); if ($onlyMine) { $stmtfileexists->bind_param('ii', $fileId, $_SESSION['id']); @@ -191,7 +191,8 @@ function fileExists(int $fileId, bool $onlyMine = true): bool|string $stmtfileexists->bind_param('i', $fileId); } $filePath = ""; - $stmtfileexists->bind_result($filePath); + $id = 0; + $stmtfileexists->bind_result($id, $filePath); $stmtfileexists->execute(); if ($stmtfileexists->num_rows > 0){ return $filePath;