http-root/local/media/get.php
2026-10-01 03:13:29 +09:00

19 lines
596 B
PHP

<?php
$_shared = $_SERVER["DOCUMENT_ROOT"]."/templates";
require "$_shared/lib.php";
$_title = "Media viewer";
require "$_shared/header.php";
$urls_base = __DIR__ . "/urls";
if (isset($_GET["list"])) {
$file = "$urls_base/" . $_GET["list"];
$urls = json_decode(file_get_contents($file));
header("Location: " . $urls[array_rand($urls)]);
} else {
foreach (scandir($urls_base) as $list) {
if ($list === '.' || $list === '..')
continue;
echo "<a href='" . $_SERVER['PHP_SELF'] . "?list=$list'>Try $list</a><br>";
}
}
require "$_shared/footer.php";
?>