-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_download.php
32 lines (25 loc) · 1011 Bytes
/
file_download.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php define('ACCESS', true);
include_once '.init.php';
if (IS_LOGIN) {
$title = 'Tải tập tin';
if ($dir == null || $name == null || !is_file(processDirectory($dir . '/' . $name))) {
include_once 'header.php';
echo '<div class="title">' . $title . '</div>';
echo '<div class="list"><span>Đường dẫn không tồn tại</span></div>
<div class="title">Chức năng</div>
<ul class="list">
<li><img src="icon/list.png"/> <a href="index.php">Danh sách</a></li>
</ul>';
include_once 'footer.php';
} else {
$dir = processDirectory($dir);
$path = $dir . '/' . $name;
header('Content-Type: application/octet-stream');
header('Content-Disposition: inline; filename=' . $name);
header('Content-Length: ' . filesize($path));
readfile($path);
}
} else {
goURL('login.php');
}
?>