-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path404.php
45 lines (42 loc) · 1.14 KB
/
404.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
$files = glob("./animals/**/*");
$file = substr($files[array_rand($files)], 2);
if (getenv("PROTOCOL")) {
$proto = getenv("PROTOCOL");
}
else {
$proto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
}
$host = $proto . "://$_SERVER[HTTP_HOST]/";
echo <<<EOF
<html lang='en'>
<head>
<title>Random Animals!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Galen Guyer">
<meta name="description" content="Get a random animal picture!" />
<style>
body {
font-family: Arial, Helvetica, sans-serif;
text-align: center;
}
img {
max-width: 90vw;
max-height: 70vh;
}
</style>
</head>
<body>
<header>
<h1>Oops, it looks like that file doesn't exist!</h1>
</header>
<h3>To make it up to you, here's a random animal</h3>
<img src="$host$file"></img>
<p>Permalink: <a href="$host$file">$host$file</a></p>
<script data-goatcounter="https://randomanimals.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
</body>
</html>
EOF;
?>