summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorilotterytea <me@ilotterytea.kz>2025-10-10 20:55:37 +0500
committerilotterytea <me@ilotterytea.kz>2025-10-10 20:55:37 +0500
commitb1a885ac229892bac528e6fea4e011a1b240867b (patch)
tree48152aa48c41defe7f850390ea1c99db2c725438 /index.php
initial commit
Diffstat (limited to 'index.php')
-rw-r--r--index.php93
1 files changed, 93 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..6126901
--- /dev/null
+++ b/index.php
@@ -0,0 +1,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> \ No newline at end of file