From b1a885ac229892bac528e6fea4e011a1b240867b Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Fri, 10 Oct 2025 20:55:37 +0500 Subject: initial commit --- status/index.php | 52 +++++++++++++++++++++++++++++++++++ status/post.php | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 status/index.php create mode 100644 status/post.php (limited to 'status') diff --git a/status/index.php b/status/index.php new file mode 100644 index 0000000..13d5405 --- /dev/null +++ b/status/index.php @@ -0,0 +1,52 @@ +prepare('SELECT * FROM statuses WHERE id = ?'); + $stmt->execute([$_GET['id']]); + + $status = $stmt->fetch(PDO::FETCH_ASSOC) ?: null; +} else { + $stmt = $db->query('SELECT id, title, posted_at FROM statuses ORDER BY posted_at DESC'); + $statuses = $stmt->fetchAll(PDO::FETCH_ASSOC); +} +?> + + + + + statuses - ilt.su + + + + + + + + +
+

ilt.su - statuses

+ +

No title.' ?>

+
+ No contents.' ?> +
+

Posted ago

+ + + +

Statuses

+ + +
+ + + \ No newline at end of file diff --git a/status/post.php b/status/post.php new file mode 100644 index 0000000..064d86f --- /dev/null +++ b/status/post.php @@ -0,0 +1,84 @@ +prepare('INSERT INTO statuses(title, contents) VALUES (?, ?)') + ->execute([$title, $contents]); + + $id = $db->lastInsertId(); + + header("Location: /status/?id=$id"); + exit; +} + +if (isset($_GET['id']) && !empty(trim($_GET['id']))) { + $stmt = $db->prepare('SELECT * FROM statuses WHERE id = ?'); + $stmt->execute([$_GET['id']]); + + $status = $stmt->fetch(PDO::FETCH_ASSOC) ?: null; +} else { + $stmt = $db->query('SELECT id, title, posted_at FROM statuses ORDER BY posted_at DESC'); + $statuses = $stmt->fetchAll(PDO::FETCH_ASSOC); +} +?> + + + + + new status - ilt.su + + + + + + + + +
+

ilt.su - statuses

+

post a new status

+
+ + + + + + + + + + + + + +
title:
contents:
+
+
+ + + \ No newline at end of file -- cgit v1.2.3