-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
56 lines (53 loc) · 1.39 KB
/
Copy pathmain.php
File metadata and controls
56 lines (53 loc) · 1.39 KB
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
<?php
echo '
<head>
<title>THE CRYPT</title>
<link rel="shortcut icon" href="favicon.png"/>
<link rel="stylesheet" type="text/css" href="php.css">
</head>
';
function main() {
$home = ""; // DEFINE STARTING DIRECTORY HERE
if ($home == "") {
$home = "./";
}
$dir = (isset($_GET['dir']) ? $_GET['dir'] : null);
if ($dir == "") {
header("Location: main.php?dir=" . $home);
exit;
}
$arr = array();
$i = 0;
$olddir = dirname($dir);
chdir($dir);
echo "<div class='dir'>Current dir: " . getcwd() . "</div><br>";
echo "<a class='link' href ='main.php?dir=" . $olddir . "'>" . 'BACK' . "</a>";
if (isset($_GET['dir']) ? $_GET['dir'] : null) {
$dir = (isset($_GET['dir']) ? $_GET['dir'] : null);
}
echo "<hr>";
foreach (glob("*.mp4", GLOB_BRACE) as $files) {
array_push($arr, $files);
$name= preg_replace('/\\.[^.\\s]{3,4}$/', '', $arr[$i]);
echo "
<div class='container'>
<div class='content'>
<a href='$dir/$arr[$i]' target='blank' alt='$name' title='$name'>
<img class='thumb' src='$dir/$arr[$i].jpg'>
$name
</a>
</div>
</div>";
$i++;
}
foreach (glob("*", GLOB_ONLYDIR) as $folders) {
echo "
<div class='container'>
<div class='content'>
<a href='main.php?dir=" . $dir . "/" . $folders . "'><img src='folder.png' style='width: 10vw;'><br>" . $folders . "</a>
</div>
</div>";
}
}
main();
?>