-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlive.php
More file actions
68 lines (56 loc) · 1.8 KB
/
live.php
File metadata and controls
68 lines (56 loc) · 1.8 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
57
58
59
60
61
62
63
64
65
66
67
68
<?php
// live.php - router for Xtream-style /live/... links
require_once __DIR__ . '/helpers.php';
// Path: /live/{u}/{pass_or_token}/{id}.{ext}
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH) ?: '';
$parts = array_values(array_filter(explode('/', $uri)));
if (count($parts) < 4 || strtolower($parts[0]) !== 'live') {
http_response_code(404);
exit('Not Found');
}
$u = rawurldecode((string)$parts[1]);
// Optional: obfuscated usernames (u_... or u64_...)
if (strpos($u, "u_") === 0 || strpos($u, "u64_") === 0) {
$dec = gc_user_deobfuscate($u);
if ($dec === "") {
http_response_code(400);
exit("Bad Request");
}
$u = $dec;
}
$cred = rawurldecode((string)$parts[2]);
// Basic hardening: prevent path breaking/null bytes
if (strpos($u, '/') !== false || strpos($cred, '/') !== false || strpos($u, "