-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.php
56 lines (48 loc) · 1.62 KB
/
index.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
//=============================================================================//
// SCRIPT WRITTEN BY @YGX_WORLD TEAM, FOR EDUCATION PURPOSE ONLY.
// Don't Sell this Script, This is 100% Free.
//=============================================================================//
include_once '_functions.php';
$userAgent = $_SERVER['HTTP_USER_AGENT'] ?? "Mozilla/5.0";
$id = $_GET['id'] ?? null;
if (!$id) {
http_response_code(400);
die("Channel id not found in parameter.");
}
function getCookieZee5($userAgent) {
$UAhash = md5($userAgent);
$cacheFile = "tmp/cookie_z5_$UAhash.tmp";
if (!file_exists(dirname($cacheFile))) {mkdir(dirname($cacheFile), 0755, true);}
$cacheExpiry = 43000; // 12 hour
if (file_exists($cacheFile) && (time() - filemtime($cacheFile) < $cacheExpiry)) {
return file_get_contents($cacheFile);
}
$data = generateCookieZee5($userAgent);
if (isset($data['cookie'])) {
file_put_contents($cacheFile, $data['cookie']);
return $data['cookie'];
}
}
$file = 'data.json';
$json_data = file_get_contents($file);
if ($json_data === false) {
http_response_code(500);
die('data.json file not found.');
}
$data = json_decode($json_data, true);
$channelData = null;
foreach ($data['data'] as $channel) {
if ($channel['id'] == $id) {
$channelData = $channel;
break;
}
}
if ($channelData === null) {
http_response_code(404);
die('Channel not found.');
}
$initialUrl = $channelData['url'];
$w = getCookieZee5($userAgent);
header("Location: $initialUrl?$w");exit;
//@yuvraj824