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/intermission.php | |
download | movies-9eabae58420ecb3cc289d6d7ff4c2414f9c63370.tar.gz movies-9eabae58420ecb3cc289d6d7ff4c2414f9c63370.tar.bz2 movies-9eabae58420ecb3cc289d6d7ff4c2414f9c63370.zip |
Initial commit
Diffstat (limited to 'tv/intermission.php')
-rw-r--r-- | tv/intermission.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tv/intermission.php b/tv/intermission.php new file mode 100644 index 0000000..e9b9e06 --- /dev/null +++ b/tv/intermission.php @@ -0,0 +1,23 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; + +$list = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/intermissions"); +$plist = []; + +foreach ($list as $item) { + if ($item !== "." && $item !== "..") { + array_push($plist, $item); + } +} + +shuffle($plist); +$film = $plist[rand(0, count($plist) - 1)]; +$id = bin2hex(random_bytes(96)); + +$source = $_SERVER['DOCUMENT_ROOT'] . "/data/intermissions/" . $film; +$dest = $_SERVER['DOCUMENT_ROOT'] . "/cdn/video/" . $id . ".mp4"; +symlink($source, $dest); + +header("Location: /cdn/video/" . $id . ".mp4"); +exit;
\ No newline at end of file |