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
23
index.html
23
index.html
|
@ -1,23 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Weh?</title>
|
||||
<link rel="stylesheet" href="weh.css">
|
||||
<link rel="icon" type="image/x-icon" href="weh.ico">
|
||||
<meta property="og:title" content="Weh?">
|
||||
<meta property="og:description" content="Can it fangs! You don't know diddly dang about squiddly squat!">
|
||||
<meta property="og:image" content="/weh.png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Weh?</h1>
|
||||
<div class="weh"></div>
|
||||
<script src="./weh.js"></script>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
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…
Reference in a new issue