-
Notifications
You must be signed in to change notification settings - Fork 1
/
header.php
44 lines (31 loc) · 1.26 KB
/
header.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
<?php
$dir = urldecode($_SERVER["DOCUMENT_ROOT"].$_SERVER["REQUEST_URI"]);
$dir = preg_replace("/(\?.+)/","",$dir);
echo "<h2>".urldecode($_SERVER["REQUEST_URI"])."</h2>";
chdir($dir);
$files = glob("*.mp3");
preg_grep("/\.mp3$/i", $files);
// no mp3s here? quit
if (sizeof($files)==0) die();
// otherwise continue w the page!
?>
<link rel="stylesheet" type="text/css" href="/jmplayer/jmplayer.css" />
<script type="text/javascript">
var files = <?php echo json_encode($files)."\n"; ?>
var getParams = <?php echo json_encode($_GET)."\n"; ?>
</script>
<script type="text/javascript" src="/jmplayer/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="/jmplayer/jmplayer.js"></script>
<?php
if (isset($_GET["download"])==TRUE) {
$downloadFileName = time(true).".zip";
shell_exec("zip -0 /tmp/$downloadFileName *");
rename("/tmp/$downloadFileName", "/var/www/html/download/$downloadFileName");
?>
<script type="text/javascript">
//console.log("<?php echo $_SERVER["REQUEST_URI"] ?>");
window.open(window.location.origin + "/download/<?php echo $downloadFileName ?>");
</script>
<?php
}
?>