From 0927396783def9b30defed5311822e0440ef7bbb Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sat, 31 Jan 2026 14:43:39 +0000 Subject: [PATCH] Auto commit: 2026-01-31T14:43:39.337Z --- db/migrations/001_create_songs_table.sql | 7 + index.php | 260 +++++++++++++++++++---- manage_songs.php | 49 +++++ 3 files changed, 271 insertions(+), 45 deletions(-) create mode 100644 db/migrations/001_create_songs_table.sql create mode 100644 manage_songs.php diff --git a/db/migrations/001_create_songs_table.sql b/db/migrations/001_create_songs_table.sql new file mode 100644 index 0000000..6c85888 --- /dev/null +++ b/db/migrations/001_create_songs_table.sql @@ -0,0 +1,7 @@ +CREATE TABLE IF NOT EXISTS songs ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + artist VARCHAR(255) NOT NULL, + is_active TINYINT(1) DEFAULT 0, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/index.php b/index.php index 37962ba..2a6a28d 100644 --- a/index.php +++ b/index.php @@ -26,11 +26,22 @@ $promoImage = "assets/pasted-20260130-234122-115a4b49.png"; $qrImage = "assets/pasted-20260131-000858-4fff58f0.jpg"; $logoImage = "assets/pasted-20260131-002028-7985dfae.png"; -// Fetch latest requests +// Fetch latest requests and songs $requests = []; +$songs = []; try { $stmt = db()->query("SELECT name, phone, message, created_at FROM listener_requests ORDER BY created_at DESC LIMIT 20"); $requests = $stmt->fetchAll(); + + $stmtSongs = db()->query("SELECT * FROM songs ORDER BY created_at DESC"); + $songs = $stmtSongs->fetchAll(); + $activeSong = null; + foreach ($songs as $s) { + if ($s["is_active"]) { + $activeSong = $s; + break; + } + } } catch (Exception $e) { // Silently fail if table doesn't exist yet or other DB error } @@ -406,6 +417,75 @@ try { .qr-container:hover { transform: scale(1.1); } + + /* New styles for Song Management */ + .nav-pills-glass .nav-link { + color: rgba(255,255,255,0.6); + border-radius: 15px; + padding: 0.5rem 1.5rem; + font-weight: 600; + transition: all 0.3s ease; + } + .nav-pills-glass .nav-link.active { + background: var(--primary-color); + color: #fff; + box-shadow: 0 5px 15px rgba(255, 45, 85, 0.4); + } + .song-item { + background: rgba(255,255,255,0.05); + border: 1px solid rgba(255,255,255,0.08); + border-radius: 20px; + padding: 1rem 1.5rem; + margin-bottom: 1rem; + display: flex; + justify-content: space-between; + align-items: center; + transition: all 0.3s ease; + } + .song-item:hover { + background: rgba(255,255,255,0.1); + } + .song-active { + border-color: var(--primary-color); + background: rgba(255, 45, 85, 0.1); + } + .song-title-text { + font-weight: 700; + display: block; + } + .song-artist-text { + font-size: 0.8rem; + opacity: 0.6; + } + .btn-toggle-song { + background: rgba(255,255,255,0.1); + color: #fff; + border: none; + border-radius: 12px; + padding: 5px 15px; + font-size: 0.8rem; + font-weight: 600; + transition: all 0.3s ease; + } + .btn-toggle-song.active { + background: var(--primary-color); + } + .btn-delete-song { + background: rgba(255,0,0,0.1); + color: #ff4444; + border: none; + border-radius: 50%; + width: 32px; + height: 32px; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.3s ease; + } + .btn-delete-song:hover { + background: #ff4444; + color: #fff; + } @@ -422,8 +502,8 @@ try {
- Conectando... - Lili Records Radio + +
@@ -462,45 +542,117 @@ try {
- +
Lili Records Promo
-
-
-
Mensajes de Oyentes
-

Gestiona las peticiones en tiempo real

-
-
- QR Pago -

APOYAR

-
-
-
- -
- -

No hay mensajes todavía.

-
- - -
- -

-
- - - - - - -
+ + +
+ +
+
+
+
Mensajes de Oyentes
+

Peticiones en tiempo real

- - +
+ QR Pago +

QR

+
+
+
+ +
+ +

No hay mensajes todavía.

+
+ + +
+ +

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

No hay canciones en la lista.

+
+ + +
+
+ + +
+
+
+ + + +
+
+ + + +
+
+
+ + +
+
+
@@ -514,10 +666,29 @@ try {
+ + +
+
Lista de Canciones
+ +
+
+ + +
+ + SONANDO + +
+ +
+ + +
Últimos Mensajes

Sé el primero en escribir...

- +

@@ -611,6 +782,7 @@ try { const artistName = document.getElementById('artistName'); const canvas = document.getElementById('visualizer'); const ctx = canvas.getContext('2d'); + const hasActiveSong = ; let isPlaying = false; let audioContext; @@ -627,7 +799,7 @@ try { source = audioContext.createMediaElementSource(audio); source.connect(analyser); analyser.connect(audioContext.destination); - analyser.fftSize = 64; // Fewer bars for a cleaner, modern look + analyser.fftSize = 64; const bufferLength = analyser.frequencyBinCount; dataArray = new Uint8Array(bufferLength); } catch (e) { @@ -646,26 +818,23 @@ try { const width = canvas.width; const height = canvas.height; - // We only use the first half of the frequency data because the high end is often empty const barCount = dataArray.length / 1.2; const barWidth = (width / barCount); let x = 0; for (let i = 0; i < barCount; i++) { let barHeight = (dataArray[i] / 255) * height * 0.8; - if (barHeight < 5) barHeight = 5; // Minimum bar height for visibility + if (barHeight < 5) barHeight = 5; - // Create a vibrant gradient for each bar const gradient = ctx.createLinearGradient(0, height - barHeight, 0, height); - gradient.addColorStop(0, '#ff2d55'); // Hot Pink - gradient.addColorStop(0.5, '#ff512f'); // Vibrant Orange-Red + gradient.addColorStop(0, '#ff2d55'); + gradient.addColorStop(0.5, '#ff512f'); gradient.addColorStop(1, 'rgba(255, 45, 85, 0.2)'); ctx.fillStyle = gradient; - // Draw stylized bars with rounded tops - const bx = x + 2; // small padding - const bw = barWidth - 4; // bar thickness + const bx = x + 2; + const bw = barWidth - 4; const bh = barHeight; const by = height - bh; const radius = bw / 2; @@ -708,6 +877,7 @@ try { }); async function fetchMetadata() { + if (hasActiveSong) return; { try { const response = await fetch('https://api.radioking.io/widget/radio/lili-record-s-radio/track/current'); const data = await response.json(); diff --git a/manage_songs.php b/manage_songs.php new file mode 100644 index 0000000..d623195 --- /dev/null +++ b/manage_songs.php @@ -0,0 +1,49 @@ +prepare("INSERT INTO songs (title, artist) VALUES (?, ?)"); + $stmt->execute([$title, $artist]); + } +} elseif ($action === 'delete') { + $id = $_POST['id'] ?? ''; + if ($id) { + $stmt = db()->prepare("DELETE FROM songs WHERE id = ?"); + $stmt->execute([$id]); + } +} elseif ($action === 'toggle_active') { + $id = $_POST['id'] ?? ''; + if ($id) { + // First, check the current status + $stmt = db()->prepare("SELECT is_active FROM songs WHERE id = ?"); + $stmt->execute([$id]); + $current = $stmt->fetchColumn(); + + if ($current) { + // Deactivate it + $stmt = db()->prepare("UPDATE songs SET is_active = 0 WHERE id = ?"); + $stmt->execute([$id]); + } else { + // Activate this one and deactivate ALL others + $stmt = db()->prepare("UPDATE songs SET is_active = 0"); + $stmt->execute(); + $stmt = db()->prepare("UPDATE songs SET is_active = 1 WHERE id = ?"); + $stmt->execute([$id]); + } + } +} + +header('Location: index.php?admin=lili'); +exit; \ No newline at end of file