summaryrefslogtreecommitdiff
path: root/index.php
blob: 61269010fc56a5222ff23c70d646d3bb10dc046c (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/lib/time.php';
if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/projects.json") && $contents = file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/projects.json")) {
    $projects = json_decode($contents, true);
}
if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/links.json") && $contents = file_get_contents("{$_SERVER['DOCUMENT_ROOT']}/links.json")) {
    $links = json_decode($contents, true);
}
$db = new PDO("sqlite:{$_SERVER['DOCUMENT_ROOT']}/database.db");
$stmt = $db->query("SELECT id, title, posted_at FROM statuses ORDER BY posted_at DESC LIMIT 1");
$last_status = $stmt->fetch(PDO::FETCH_ASSOC) ?: null;
?>
<!DOCTYPE html>
<html>

<head>
    <title>ilotterytea</title>
    <meta name="description" content="my personal website.">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <link rel="stylesheet" href="/static/style.css">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <meta name="robots" content="nofollow">
</head>

<body>
    <main>
        <div class="rain">
            <p><img src="/static/img/pepe.png" alt="FeelsBadMan ☔ " width="18" height="18"> I'm just a memer</p>
        </div>
        <?php if (isset($projects)): ?>
            <section class="projects">
                <?php foreach ($projects as $p): ?>
                    <div class="project">
                        <div class="icon-wrapper">
                            <img src="<?= $p['banner'] ?? '' ?>" alt="">
                        </div>
                        <div class="summary">
                            <div class="title">
                                <h2><?= $p['title'] ?? 'No title.' ?> <span class="year"><?= $p['year'] ?></span></h2>
                                <?php if (isset($p['links'])): ?>
                                    <div class="links">
                                        <?php foreach ($p['links'] as $l): ?>
                                            <a href="<?= $l['url'] ?>" class="button <?= $l['style'] ?? '' ?>"><?= $l['name'] ?></a>
                                        <?php endforeach; ?>
                                    </div>
                                <?php endif; ?>
                            </div>
                            <p><?= $p['description'] ?? '<i>No description</i>' ?></p>
                            <?php if (isset($p['screenshots'])): ?>
                                <div class="screenshots">
                                    <?php foreach ($p['screenshots'] as $s): ?>
                                        <a href="<?= $s ?>" target="_BLANK"><img src="<?= $s ?>" alt="Screenshot"></a>
                                    <?php endforeach; ?>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>
                <?php endforeach; ?>
            </section>
        <?php endif; ?>
        <?php if (isset($last_status)): ?>
            <div class="status">
                <p>Last status posted <?= format_timestamp(time() - strtotime($last_status['posted_at'])) ?> ago: <a
                        href="/status/?id=<?= $last_status['id'] ?>"><?= $last_status['title'] ?? 'No title.' ?></a></p>
                <p style="font-size:10px;"><a href="/status/">[more...]</a> <a href="/rss.php"><img
                            src="/static/img/rss.png" alt="[rss]"></a></p>
            </div>
        <?php endif; ?>
        <?php if (isset($links)): ?>
            <div class="main-links">
                <?php foreach ($links as $l): ?>
                    <a href="<?= $l['url'] ?>"><img src="/static/img/<?= $l['icon'] ?>.png" alt=""><?= $l['title'] ?></a>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
    </main>
</body>

<script>
    const links = document.querySelector(".main-links");
    if (links) {
        const link = document.createElement("a");
        link.href = [109, 97, 105, 108, 116, 111, 58, 105, 108, 116, 115, 117, 64, 97, 108, 114, 105, 103, 104, 116, 46, 112, 97, 114, 116, 121].map(x => String.fromCharCode(x)).join('');
        const img = document.createElement("img");
        img.src = "/static/img/letter.png";
        img.alt = "";
        link.appendChild(img);
        link.innerHTML += atob(["bWFpb", "CB", "tZSE="].join(''));
        links.appendChild(link);
    }
</script>

</html>