Skip to content

Commit d5441fd

Browse files
committed
Added file existence check.
I added a check to see if the file exists.
1 parent 8503efa commit d5441fd

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

web/download/file/index.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,16 @@
88

99
$user = $_SESSION['user'];
1010
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
11-
$user=$_SESSION['look'];
11+
$user = $_SESSION['look'];
1212
}
1313

14-
if (!empty($_REQUEST['path'])) {
15-
$path = $_REQUEST['path'];
14+
$path = $_REQUEST['path'];
15+
if (!empty($path) && file_exists($path)) {
1616
header("Content-type: application/octet-stream");
1717
header("Content-Transfer-Encoding: binary");
1818
header("Content-disposition: attachment;filename=".basename($path));
19-
passthru (VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
19+
passthru(VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
2020
exit;
21-
}
22-
else {
21+
} else {
2322
die('File not found');
2423
}
25-
26-
27-
?>

0 commit comments

Comments
 (0)