diff options
author | Minteck <minteck@phoenixnet.tech> | 2021-10-31 12:30:56 +0100 |
---|---|---|
committer | Minteck <minteck@phoenixnet.tech> | 2021-10-31 12:30:56 +0100 |
commit | 9eabae58420ecb3cc289d6d7ff4c2414f9c63370 (patch) | |
tree | 055f950af077d2be7f65ae1f3b2a11362f0d3556 /tv/watch.php | |
download | movies-9eabae58420ecb3cc289d6d7ff4c2414f9c63370.tar.gz movies-9eabae58420ecb3cc289d6d7ff4c2414f9c63370.tar.bz2 movies-9eabae58420ecb3cc289d6d7ff4c2414f9c63370.zip |
Initial commit
Diffstat (limited to 'tv/watch.php')
-rw-r--r-- | tv/watch.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tv/watch.php b/tv/watch.php new file mode 100644 index 0000000..def8da7 --- /dev/null +++ b/tv/watch.php @@ -0,0 +1,27 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; + +if (!isset($_GET['i'])) { + die(); +} + +if (strpos($_GET['i'], ".") !== false || strpos($_GET['i'], "/") !== false) { + die(); +} + +$film = $_GET['i']; +$id = bin2hex(random_bytes(96)); + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/films/video/" . $film . '@4K.mp4')) { + $source4k = $_SERVER['DOCUMENT_ROOT'] . "/data/films/video/" . $film . '@4K.mp4'; + $dest4k = $_SERVER['DOCUMENT_ROOT'] . "/cdn/video/" . $id . ".mp4"; + symlink($source4k, $dest4k); +} else { + $source = $_SERVER['DOCUMENT_ROOT'] . "/data/films/video/" . $film . '.mp4'; + $dest = $_SERVER['DOCUMENT_ROOT'] . "/cdn/video/" . $id . ".mp4"; + symlink($source, $dest); +} + +header("Location: /cdn/video/" . $id . ".mp4"); +exit;
\ No newline at end of file |