diff --git a/api/get_likes.php b/api/get_likes.php new file mode 100644 index 0000000..6f8bb48 --- /dev/null +++ b/api/get_likes.php @@ -0,0 +1,20 @@ + 0]); + exit; +} + +try { + $stmt = db()->prepare("SELECT likes_count FROM song_likes WHERE song_title = ?"); + $stmt->execute([$song_title]); + $count = $stmt->fetchColumn(); + echo json_encode(['likes_count' => (int)($count ?: 0)]); +} catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); +} diff --git a/api/get_top_fans.php b/api/get_top_fans.php new file mode 100644 index 0000000..7f187cb --- /dev/null +++ b/api/get_top_fans.php @@ -0,0 +1,14 @@ +query("SELECT username, total_likes FROM user_likes ORDER BY total_likes DESC LIMIT 5"); + $fans = $stmt->fetchAll(PDO::FETCH_ASSOC); + + echo json_encode(['success' => true, 'fans' => $fans]); +} catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); +} diff --git a/api/like_song.php b/api/like_song.php new file mode 100644 index 0000000..9364376 --- /dev/null +++ b/api/like_song.php @@ -0,0 +1,39 @@ + 'Faltan datos']); + exit; +} + +try { + $pdo = db(); + + // 1. Update/Insert into song_likes + $stmt = $pdo->prepare("INSERT INTO song_likes (song_title, likes_count) VALUES (?, 1) ON DUPLICATE KEY UPDATE likes_count = likes_count + 1"); + $stmt->execute([$song_title]); + + // 2. Update/Insert into user_likes + $stmtUser = $pdo->prepare("INSERT INTO user_likes (username, total_likes) VALUES (?, 1) ON DUPLICATE KEY UPDATE total_likes = total_likes + 1"); + $stmtUser->execute([$username]); + + // 3. Post to chat + $message = "¡Le dio un ❤️ a la canción: $song_title!"; + $stmtChat = $pdo->prepare("INSERT INTO messages (username, message) VALUES (?, ?)"); + $stmtChat->execute([$username, $message]); + + // 3. Get total likes for this song + $stmtCount = $pdo->prepare("SELECT likes_count FROM song_likes WHERE song_title = ?"); + $stmtCount->execute([$song_title]); + $count = $stmtCount->fetchColumn(); + + echo json_encode(['success' => true, 'likes_count' => $count]); +} catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); +} diff --git a/db/migrations/002_create_song_likes.sql b/db/migrations/002_create_song_likes.sql new file mode 100644 index 0000000..0f3ed3e --- /dev/null +++ b/db/migrations/002_create_song_likes.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS song_likes ( + id INT AUTO_INCREMENT PRIMARY KEY, + song_title VARCHAR(255) NOT NULL UNIQUE, + likes_count INT DEFAULT 0, + last_liked_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); diff --git a/db/migrations/003_create_user_likes.sql b/db/migrations/003_create_user_likes.sql new file mode 100644 index 0000000..3d08c81 --- /dev/null +++ b/db/migrations/003_create_user_likes.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS user_likes ( + username VARCHAR(255) PRIMARY KEY, + total_likes INT DEFAULT 0, + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); diff --git a/index.php b/index.php index bdf5b36..4574749 100644 --- a/index.php +++ b/index.php @@ -584,6 +584,16 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; 100% { transform: scale(1); opacity: 1; } } + .fan-1 { color: #facc15 !important; font-weight: 800 !important; text-shadow: 0 0 10px rgba(250, 204, 21, 0.5); } + .fan-2 { color: #cbd5e1 !important; font-weight: 700 !important; } + .fan-3 { color: #fb923c !important; font-weight: 700 !important; } + + @keyframes fan-entry { + 0% { transform: scale(0.8); opacity: 0; } + 50% { transform: scale(1.1); } + 100% { transform: scale(1); opacity: 1; } + } + /* Responsive */ @media (max-width: 992px) { .app-container { @@ -599,6 +609,9 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; .interaction-center { grid-template-columns: 1fr !important; } + .chat-window, .ranking-window { + height: 400px !important; + } .image-section { padding-left: 0; width: 100%; @@ -607,7 +620,6 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; aspect-ratio: 1 / 1; } } - @media (max-width: 600px) { .form-row { grid-template-columns: 1fr; @@ -648,6 +660,10 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
Cargando stream...
EN VIVO
+
@@ -702,8 +718,8 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; - -
+ +

@@ -721,6 +737,20 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";

+ + +
+

+ TOP FANS +

+
+ +
Calculando ranking...
+
+
+ ¡Dales "Like" a tus canciones favoritas para subir en el ranking! +
+
@@ -738,7 +768,9 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489"; + +