diff --git a/gif/index.php b/gif/index.php index ee99d1c..61cecc4 100644 --- a/gif/index.php +++ b/gif/index.php @@ -1,25 +1,37 @@ '/assets/gifs/' . basename($f), $gif_files); -$random = !empty($gifs) ? $gifs[array_rand($gifs)] : ''; +$gif_files = array_values($gif_files); -$base_url = 'https://sistav.com'; -$gif_url = $base_url . $random; -?> - - - - - - - +// If a specific GIF was requested via ?id=, serve its embed +if (isset($_GET['id'])) { + $id = (int)$_GET['id']; + $gif = isset($gif_files[$id]) + ? '/assets/gifs/' . basename($gif_files[$id]) + : ''; - - - + $base_url = 'https://sistav.com'; + $gif_url = $base_url . $gif; + ?> + + + + + + + + + + + + + + - - - - \ No newline at end of file +// No ?id= — pick a random GIF and redirect to its unique URL +// The random token makes the URL unique so Discord won't serve a cached embed +$id = array_rand($gif_files); +$token = bin2hex(random_bytes(4)); // e.g. ?id=3&t=a1b2c3d4 +header("Location: /gif?id={$id}&t={$token}"); +exit; \ No newline at end of file