From a002cfc13ee99d74addee044f7bcf5d0f50608a7 Mon Sep 17 00:00:00 2001 From: floppydiskette Date: Wed, 4 Sep 2024 14:36:36 +0100 Subject: [PATCH] Remove index.html, add parameter to chose quote --- index.html | 23 ----------------------- weh.php | 7 ++++++- 2 files changed, 6 insertions(+), 24 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index f1a03e8..0000000 --- a/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - Weh? - - - - - - - - -
-

Weh?

-
- -
- - - diff --git a/weh.php b/weh.php index 9a76df9..1d87cc6 100644 --- a/weh.php +++ b/weh.php @@ -2,7 +2,12 @@ $quotes = file_get_contents('weh.json'); if ($quotes !== false) { $quotes = json_decode($quotes, true); - $quote = $quotes[array_rand($quotes)]; + if (isset($_GET['idx']) && ctype_digit($_GET['idx']) && $_GET['idx'] < count($quotes)) { + $index = $_GET['idx']; + } else { + $index = array_rand($quotes); + } + $quote = $quotes[$index]; } ?>