Remove index.html, add parameter to chose quote

This commit is contained in:
floppydiskette 2024-09-04 14:36:36 +01:00
commit a002cfc13e
No known key found for this signature in database
2 changed files with 6 additions and 24 deletions

View file

@ -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];
}
?>
<!DOCTYPE html>