This commit is contained in:
Bruno Rybársky 2024-04-25 23:25:43 +02:00
parent 826df55412
commit a507b507a5

@ -184,7 +184,6 @@ function fileExists(int $fileId, bool $onlyMine = true): bool|string
$onlyMine = true; $onlyMine = true;
} }
$query = 'SELECT Path FROM Files WHERE ID = ?' . ($onlyMine ? ' AND UploadedBy = ?' : ''); $query = 'SELECT Path FROM Files WHERE ID = ?' . ($onlyMine ? ' AND UploadedBy = ?' : '');
echo $query;
$stmtfileexists = $mysqli->prepare($query); $stmtfileexists = $mysqli->prepare($query);
if ($onlyMine) { if ($onlyMine) {
$stmtfileexists->bind_param('ii', $fileId, $_SESSION['id']); $stmtfileexists->bind_param('ii', $fileId, $_SESSION['id']);
@ -194,7 +193,7 @@ function fileExists(int $fileId, bool $onlyMine = true): bool|string
$filePath = ""; $filePath = "";
$stmtfileexists->bind_result($filePath); $stmtfileexists->bind_result($filePath);
$stmtfileexists->execute(); $stmtfileexists->execute();
if (!empty($filePath)){ if ($stmtfileexists->num_rows > 0){
return $filePath; return $filePath;
} }
else { else {