From 037d15b650a88327e89c0766261587b52c3a352f Mon Sep 17 00:00:00 2001 From: biglyderv Date: Wed, 27 Nov 2024 00:13:33 -0500 Subject: [PATCH] the show starts kinda --- docs/css/main.css | 18 +++++++++++++---- docs/index.php | 51 +++++++++++++++++++++++++++++++++++++++++++---- libs/auth.php | 6 +++--- libs/page.php | 1 + scripts/init.sql | 3 ++- 5 files changed, 67 insertions(+), 12 deletions(-) diff --git a/docs/css/main.css b/docs/css/main.css index f929b8b..e865a94 100644 --- a/docs/css/main.css +++ b/docs/css/main.css @@ -22,6 +22,10 @@ body { margin-top: 0 } +pre { + white-space: pre-wrap; +} + .banner { justify-content: center; margin-bottom: calc(-1*var(--elem-height)) @@ -49,17 +53,22 @@ body { .banner, .banner-background, -.content { +.content, +.comment { width: var(--elem-width) } .avatar { display: flex; - justify-content: space-between; - width: var(--elem-width); + justify-content: space-around; + width: 300px; align-items: center; } +.banner pre { + width: var(--elem-width); +} + .avatar-img { width: 50px; height: 50px; @@ -78,7 +87,8 @@ body { .form-button, .form-input, -.form { +.form, +.comment { border: solid var(--gray) 3px; background: var(--black); border-radius: var(--border-radius); diff --git a/docs/index.php b/docs/index.php index 3036608..a188438 100644 --- a/docs/index.php +++ b/docs/index.php @@ -1,10 +1,53 @@ prepare("INSERT INTO main.comment (username, targetType, targetId, date, content, id) VALUES (?,?,?,?,?,?)"); + $stmt->execute([$username,"root","root",microtime(true) - $ref,$postie,bin2hex(random_bytes(16))]); + } + page_header(); -?> + + $form_message = post_handler(); + + // todo: make this not look weird + if ($username) { + form("Broadcast your thoughts...", $form_message, array( + array('key' => 'Post', 'type' => 'textarea', 'name' => 'post', 'default' => '') + )); + } + + $stmt = $db->prepare("SELECT * FROM comment ORDER BY date DESC"); + $stmt->execute([]); + + $posts = $stmt->fetchAll(PDO::FETCH_DEFAULT); -

Very barren.

- - +
+
+ .png' class='avatar-img'> +
+
+ '> + + +
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/libs/auth.php b/libs/auth.php index 2f316f9..1e05851 100644 --- a/libs/auth.php +++ b/libs/auth.php @@ -2,7 +2,7 @@ require("../libs/test_secret.php"); function auth($token) { - if (is_null($token)) return '!guest'; + if (is_null($token)) return null; global $db; @@ -10,7 +10,7 @@ $stmt->execute([$token]); $result = $stmt->fetch(PDO::FETCH_ASSOC); - if (!$result) return '!guest'; + if (!$result) return null; $username = $result['username']; @@ -18,7 +18,7 @@ $stmt->execute([$username]); $result = $stmt->fetch(PDO::FETCH_ASSOC); - if (!$result) return '!guest'; + if (!$result) return null; return $username; } diff --git a/libs/page.php b/libs/page.php index 3000f4f..c97975e 100644 --- a/libs/page.php +++ b/libs/page.php @@ -7,6 +7,7 @@ NewBiglyChat + diff --git a/scripts/init.sql b/scripts/init.sql index 6c0100d..28beebd 100644 --- a/scripts/init.sql +++ b/scripts/init.sql @@ -1,4 +1,5 @@ CREATE TABLE IF NOT EXISTS main.auth (username TEXT, password TEXT); CREATE TABLE IF NOT EXISTS main.token (username TEXT, token TEXT); CREATE TABLE IF NOT EXISTS main.user (username TEXT, bio TEXT); -CREATE TABLE IF NOT EXISTS main.follow (username TEXT, target TEXT); \ No newline at end of file +CREATE TABLE IF NOT EXISTS main.follow (username TEXT, target TEXT); +CREATE TABLE IF NOT EXISTS main.comment (username TEXT, targetType TEXT, targetId TEXT, date REAL, content TEXT, id TEXT); \ No newline at end of file