Remove index.html, add parameter to chose quote
This commit is contained in:
parent
cbd71c4cf4
commit
a002cfc13e
2 changed files with 6 additions and 24 deletions
7
weh.php
7
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];
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue