-
Notifications
You must be signed in to change notification settings - Fork 0
/
audio.php
56 lines (52 loc) · 1.86 KB
/
audio.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
<?php
// +-----------------------------------+
// | FoxCloud |
// +-----------------------------------+
// | Questo file fa parte del progetto |
// | di Cloud Open Source "FoxCloud", |
// | realizzato da FoxWorn. |
// +-----------------------------------+
// | Web: https://foxcloud.fcosma.it |
// | GH: github.com/FoxWorn3365/Cloud |
// | License: GNU GPL 3.0 |
// +-----------------------------------+
// | You can write me an email at: |
// | [email protected], also for |
// | talk! |
// +-----------------------------------+
$u = filter_var($_GET["user"], FILTER_SANITIZE_STRING);
$type = filter_var($_GET["type"], FILTER_SANITIZE_STRING);
$shared = filter_var($_GET["sharedurl"], FILTER_SANITIZE_STRING);
session_start();
if ($type == "shared" && file_exists("protected/shared/$shared")) {
// Carichiamo il loader
$sh = explode("{}", file_get_contents("protected/shared/$shared"));
if ($sh[0] === $u && empty($sha[3])) {
// Ok, non dico niente
$dir = str_replace("%20", " ", $sh[2]);
} elseif ($sh[0] === $u && !empty($sha[3]) && !empty($_SESSION[md5('/s/' .$shared)])) {
// Ok, non dico niente
$dir = str_replace("%20", " ", $sh[2]);
} else {
die("Permessi dello shared insufficenti / accesso negato");
}
} else {
if ($_SESSION["user"] !== $u) {
die("ERROR 02: Permission denied");
} else {
$dir = $_GET["dir"];
}
}
$user = json_decode(file_get_contents("protected/users/$u/userinfo.conf"));
$mp3 ='protected/disk/' . $user->dir . '/' . $dir;
if(file_exists($mp3)) {
header('Content-Type: audio/mpeg');
header('Content-Disposition: inline; filename="' .$url. '"');
header('Content-length: '. filesize($mp3));
header('Cache-Control: no-cache');
header('Content-Transfer-Encoding: chunked');
readfile($mp3);
exit;
} else {
echo "no file";
}