Skip to content

Commit d595886

Browse files
authored
Update filemanager.php
1 parent 6cba5ab commit d595886

File tree

1 file changed

+2
-56
lines changed

1 file changed

+2
-56
lines changed

filemanager.php

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,65 +19,11 @@
1919
* - Sorting and filtering
2020
*/
2121

22-
// CWP Usage
23-
$cwp = false;
24-
2522
// Set timezone
2623
date_default_timezone_set("Africa/Lagos");
2724

28-
if ($cwp) {
29-
$path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
30-
$segments = explode("/", trim($path, "/"));
31-
32-
$url_token = null;
33-
$url_username = null;
34-
35-
foreach ($segments as $index => $segment) {
36-
if ($segment === "filemanager.php" && $index > 0) {
37-
$url_username = $segments[$index - 1];
38-
if ($index > 1) {
39-
$url_token = $segments[$index - 2];
40-
}
41-
break;
42-
}
43-
}
44-
45-
if (!$url_username || !$url_token) {
46-
header("HTTP/1.1 403 Forbidden");
47-
echo "Access denied. Invalid URL format.";
48-
exit();
49-
}
50-
51-
$token_dir = "/home/$url_username/.tokens/";
52-
$token_file = $token_dir . $url_token;
53-
54-
if (!file_exists($token_file)) {
55-
header("HTTP/1.1 403 Forbidden");
56-
echo "Access denied. Invalid token.";
57-
exit();
58-
}
59-
60-
$token_data = json_decode(file_get_contents($token_file), true);
61-
62-
if (time() > $token_data["expiry"]) {
63-
unlink($token_file);
64-
header("HTTP/1.1 403 Forbidden");
65-
echo "Access denied. Token expired.";
66-
exit();
67-
}
68-
69-
if ($token_data["username"] !== $url_username) {
70-
header("HTTP/1.1 403 Forbidden");
71-
echo "Access denied. Username mismatch.";
72-
exit();
73-
}
74-
75-
$username = $token_data["username"];
76-
$root_path = "/home/$username";
77-
} else {
78-
$username = "joe";
79-
$root_path = "/var/www/html/001_public";
80-
}
25+
$username = ""; // Username for directory listing
26+
$root_path = ""; // Path to the root directory
8127

8228
// Configuration
8329
$config = [

0 commit comments

Comments
 (0)