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 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 15 deletions(-) (limited to 'sounds') 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

+ +
+
-- cgit v1.2.3