From d3baca2f2df52d78566024c26f694d1f26693b25 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 26 Oct 2025 16:08:03 +0500 Subject: feat: sound page --- sounds/index.php | 77 +++++++++++++++++++++++++++++++++++++++++++++----------- static/style.css | 23 +++++++++++++++++ 2 files changed, 85 insertions(+), 15 deletions(-) diff --git a/sounds/index.php b/sounds/index.php index c2a50b8..8b72940 100644 --- a/sounds/index.php +++ b/sounds/index.php @@ -4,10 +4,20 @@ include_once $_SERVER['DOCUMENT_ROOT'] . '/lib/partials.php'; $db = new PDO(DB_URL, DB_USER, DB_PASS); -$stmt = $db->prepare('SELECT * FROM sounds ORDER BY uploaded_at DESC'); -$stmt->execute(); -$sounds = $stmt->fetchAll(PDO::FETCH_ASSOC); +if (isset($_GET['id']) && !empty(trim($_GET['id']))) { + $stmt = $db->prepare('SELECT s.*, u.username AS uploader_name + FROM sounds s + LEFT JOIN users u ON u.id = s.uploaded_by + WHERE s.id = ? + '); + $stmt->execute([$_GET['id']]); + $sound = $stmt->fetch(PDO::FETCH_ASSOC) ?: null; +} else { + $stmt = $db->prepare('SELECT * FROM sounds ORDER BY uploaded_at DESC'); + $stmt->execute(); + $sounds = $stmt->fetchAll(PDO::FETCH_ASSOC); +} ?> @@ -21,19 +31,56 @@ $sounds = $stmt->fetchAll(PDO::FETCH_ASSOC);
-
- -
- - + +
+
+
+

Sound -

+
+
+ +
- - -

No sounds

- -
+ +
+ + + + + +
Uploader +

+ + + + Anonymous + +

+
+
+
+ +
+ +
+ + +
+ + +

No sounds

+ +
+
diff --git a/static/style.css b/static/style.css index 05a2676..6a62cb5 100644 --- a/static/style.css +++ b/static/style.css @@ -8,6 +8,8 @@ * { padding: 0; margin: 0; + + font-family: Arial, Helvetica, sans-serif; } body { @@ -96,4 +98,25 @@ header .brand>a { .row { display: flex; flex-direction: row; +} + +.column { + display: flex; + flex-direction: column; +} + +.justify-center { + justify-content: center; +} + +.align-center { + align-items: center; +} + +.gap-8 { + gap: 8px; +} + +.gap-16 { + gap: 16px; } \ No newline at end of file -- cgit v1.2.3