-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
73 lines (64 loc) · 2.11 KB
/
index.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
include 'config.php';
session_start();
if($login == false){
$_SESSION['username'] = "root";
} else{
if (!isset($_SESSION['username'])) {
header('Location: login.php');
$_SESSION['error'] = ['You must login first !'];
exit;
}
}
$username = $_SESSION['username'];
include 'view/header.php';
include 'module/file.php';
include 'module/download.php';
$path = isset($_GET['path']) ? urldecode($_GET['path']) : $baseDir;
$listFiles = getFilesInDirectory($path);
if (isset($_GET['act'])) {
$act = $_GET['act'];
switch ($act) {
case 'dir':
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
if (strpos($dir, $baseDir) !== 0) {
header('Location: index.php');
} else {
$listFiles = getFilesInDirectory($dir);
include 'view/child.php';
}
case 'download':
if (isset($_GET['download'])) {
$pathToDownload = $_GET['download'];
echo $pathToDownload;
download($pathToDownload);
exit;
} elseif (isset($_GET['downloadzip'])) {
$pathToDownloadZip = $_GET['downloadzip'];
echo $pathToDownload;
downloadZip($pathToDownloadZip);
exit;
} elseif (isset($_GET['downloadallzip'])) {
$pathToDownloadAllZip = $_GET['downloadallzip'];
echo $pathToDownload;
downloadAllZip($pathToDownloadAllZip);
exit;
}
break;
case 'downloadall':
$pathToDownloadAll = $_GET['downloadall'];
downloadAllZip($pathToDownloadAll);
break;
case 'logout':
session_destroy();
header('Location: login.php');
break;
default:
include 'view/body.php';
break;
}
} else {
include 'view/body.php';
}
include 'view/footer.php';
?>