summaryrefslogtreecommitdiff
path: root/404.php
blob: 7d272d3e7b7fe255d3827351ff65d1108581e9bc (plain)
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
46
47
48
<?php
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/config.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/utils.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/partials.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/accounts.php";

authorize_user();

$alert = $_SESSION['alert'] ?? [
    'code' => '404',
    'reason' => 'Not found'
];

$status = intval($alert['code']);
http_response_code($status);

$reason = str_safe($alert['reason'], 200);

?>
<html>

<head>
    <title>(Error) <?= sprintf("%s - %s", $reason, CONFIG['instance']['name']) ?></title>
    <link rel="stylesheet" href="/static/style.css">
    <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
</head>

<body>
    <div class="container">
        <div class="wrapper">
            <?php html_navigation_bar() ?>
            <section class="content">
                <h1 style="color: red;"><?= $reason ?></h1>
                <a href="/">[ Back to home ]</a>
            </section>

            <section style="position: absolute; right: 6px; bottom: 6px;">
                <img src="/static/img/404/<?php
                $files = scandir("{$_SERVER['DOCUMENT_ROOT']}/static/img/404");
                array_splice($files, 0, 2);
                echo $files[random_int(0, count($files) - 1)];
                ?>" alt=""></img>
            </section>
        </div>
    </div>
</body>

</html>