Auto commit: 2026-02-19T23:16:42.063Z

This commit is contained in:
Flatlogic Bot 2026-02-19 23:16:42 +00:00
parent e7457a62e5
commit 0eea8f587b
2 changed files with 206 additions and 1 deletions

View File

@ -49,6 +49,45 @@ try {
$stmt->execute([$cost, $username]);
echo json_encode(['success' => true, 'message' => '¡Eres DJ por un día! Tu nombre destacará en toda la sala.']);
} elseif ($item === 'vip_jump') {
$cost = 500;
$artist = $data['artist'] ?? '';
$song = $data['song'] ?? '';
if (empty($artist) || empty($song)) {
echo json_encode(['success' => false, 'error' => 'Falta artista o canción para el Salto VIP']);
exit;
}
if ($points < $cost) {
echo json_encode(['success' => false, 'error' => "Puntos insuficientes ($points/$cost)"]);
exit;
}
$pdo->beginTransaction();
try {
// Deduct points
$stmt = $pdo->prepare("UPDATE fans SET loyalty_points = loyalty_points - ? WHERE name = ?");
$stmt->execute([$cost, $username]);
// Insert priority request
$stmt = $pdo->prepare("INSERT INTO song_requests (artist, song, requester, source, is_priority) VALUES (?, ?, ?, 'vip_jump', 1)");
$stmt->execute([$artist, $song, $username]);
// Announce in chat
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1';
$ip = explode(',', $ip)[0];
$announcement = "🚀 ¡ATENCIÓN! **$username** ha usado sus puntos VIP para que suene **$artist - $song** ¡AHORA MISMO! 🔥🎧";
$stmt = $pdo->prepare("INSERT INTO messages (username, ip_address, message, type) VALUES (?, ?, ?, ?)");
$stmt->execute(['Lili Bot 🤖', $ip, $announcement, 'text']);
$pdo->commit();
echo json_encode(['success' => true, 'message' => '¡Salto VIP exitoso! Tu canción sonará a continuación.']);
} catch (Exception $e) {
$pdo->rollBack();
throw $e;
}
} elseif ($item === 'change_color') {
// If they already have god mode, changing color might be cheaper or free?
// Let's say 100 points to change color if already bought, or free if we want.

168
index.php
View File

@ -1893,6 +1893,28 @@ $twitter_link = "https://twitter.com/";
30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
40%, 60% { transform: translate3d(4px, 0, 0); }
}
@keyframes vip-flash {
0% { background: #facc15; box-shadow: 0 0 10px #facc15; color: #000; }
50% { background: #ff4444; box-shadow: 0 0 30px #ff4444; color: #fff; }
100% { background: #facc15; box-shadow: 0 0 10px #facc15; color: #000; }
}
.vip-alert-banner {
display: none;
background: #facc15;
color: #000;
padding: 12px 20px;
border-radius: 16px;
font-weight: 900;
font-size: 0.9rem;
margin-bottom: 15px;
text-align: center;
animation: vip-flash 0.8s infinite ease-in-out;
border: 2px solid rgba(255,255,255,0.5);
cursor: pointer;
box-shadow: 0 10px 20px rgba(0,0,0,0.3);
text-transform: uppercase;
letter-spacing: 1px;
}
</style>
<div class="app-container">
@ -1955,7 +1977,10 @@ $twitter_link = "https://twitter.com/";
<img id="track-cover" src="./assets/pasted-20260215-163754-def41f49.png" alt="Cover" crossorigin="anonymous" loading="lazy" onerror="this.style.display='none'; document.getElementById('cover-placeholder').style.display='block';">
</div>
<div class="track-info">
<div id="dj-host-container" style="display: flex; align-items: center; gap: 8px;">
<div id="dj-vip-alert" class="vip-alert-banner" onclick="scrollToRequests()">
<i class="bi bi-lightning-charge-fill"></i> ¡SALTO VIP PENDIENTE! PONLO AHORA 🎧
</div>
<div id="dj-host-container" style="display: flex; align-items: center; gap: 8px;">
<div class="dj-badge" onclick="adminOpenShoutout()" style="cursor: pointer;" title="DJ Panel (Admin)"><i class="bi bi-mic-fill"></i> <span id="current-dj-name">LILI</span></div>
<div id="dj-flash-poll-control" style="display: none; margin-bottom: 8px;">
<button onclick="promptFlashPoll()" style="background: rgba(250, 204, 21, 0.2); border: 1px solid #facc15; color: #facc15; font-size: 0.6rem; padding: 2px 8px; border-radius: 10px; font-weight: 800; cursor: pointer; transition: all 0.3s;" title="Lanzar Encuesta Flash">
@ -2201,6 +2226,9 @@ $twitter_link = "https://twitter.com/";
<button onclick="submitSongRequestNew()" id="submit-req-btn-new" style="flex: 2; background: var(--primary-color); color: white; border: none; padding: 1rem; border-radius: 12px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.8rem; transition: all 0.3s; box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);">
<i class="bi bi-send-check-fill"></i> ENVIAR PETICIÓN
</button>
<button onclick="submitVipJump()" id="vip-jump-btn" style="flex: 1; background: linear-gradient(135deg, #00e676, #00c853); color: white; border: none; padding: 1rem; border-radius: 12px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: all 0.3s; box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);" title="Paga 500 LP para sonar ya">
<i class="bi bi-lightning-charge-fill"></i> VIP JUMP
</button>
</div>
</div>
</div>
@ -2506,6 +2534,15 @@ $twitter_link = "https://twitter.com/";
<div class="shop-item-price">2000 <i class="bi bi-heart-fill" style="color: #00e676;"></i></div>
</div>
<div class="shop-item" onclick="promptBuyVipJump()">
<div class="shop-item-icon" style="color: #00e676;"><i class="bi bi-lightning-charge-fill"></i></div>
<div class="shop-item-info">
<div class="shop-item-name">Salto VIP</div>
<div class="shop-item-desc">Tu canción suena inmediatamente saltando la cola.</div>
</div>
<div class="shop-item-price">500 <i class="bi bi-heart-fill" style="color: #00e676;"></i></div>
</div>
<button onclick="closeShopModal()" style="width: 100%; margin-top: 1.5rem; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; padding: 0.8rem; border-radius: 12px; cursor: pointer; font-weight: 700;">Cerrar Tienda</button>
</div>
</div>
@ -3618,11 +3655,23 @@ $twitter_link = "https://twitter.com/";
}
}
function scrollToRequests() {
const list = document.getElementById('song-requests-list');
if (list) {
list.scrollIntoView({ behavior: 'smooth', block: 'center' });
list.style.animation = 'shake 0.5s ease-in-out';
setTimeout(() => list.style.animation = '', 600);
}
}
async function fetchSongRequests() {
try {
const response = await fetch('api/song_requests.php');
const result = await response.json();
// Check if there are priority requests
const hasPriority = result.success && result.requests.some(req => req.is_priority == 1);
// Check if current user is Guest DJ
const currentUserName = document.getElementById('user-name').value.trim();
let isGuestDj = false;
@ -3650,6 +3699,12 @@ $twitter_link = "https://twitter.com/";
const pollControl = document.getElementById('dj-flash-poll-control');
if (pollControl) pollControl.style.display = isGuestDj ? 'block' : 'none';
// Show/hide VIP Alert
const vipAlert = document.getElementById('dj-vip-alert');
if (vipAlert) {
vipAlert.style.display = (isGuestDj && hasPriority) ? 'block' : 'none';
}
if (result.success) {
const list = document.getElementById('song-requests-list');
if (result.requests.length === 0) {
@ -4771,6 +4826,117 @@ $twitter_link = "https://twitter.com/";
}
}
function promptBuyVipJump() {
const artist = prompt('Ingresa el ARTISTA para tu Salto VIP:');
if (!artist) return;
const song = prompt(`Ingresa la CANCIÓN de ${artist} para tu Salto VIP:`);
if (!song) return;
if (confirm(`¿Confirmas gastar 500 LP para que "${artist} - ${song}" suene inmediatamente?`)) {
redeemItem('vip_jump', null, artist, song);
}
}
async function submitVipJump() {
const artistInput = document.getElementById('req-artist-new');
const songInput = document.getElementById('req-song-new');
const artist = artistInput.value.trim();
const song = songInput.value.trim();
const requester = document.getElementById('user-name').value.trim();
if (!requester) {
alert('Por favor, ingresa tu nombre arriba para usar el Salto VIP.');
document.getElementById('user-name').focus();
return;
}
if (!artist || !song) {
alert('Por favor, ingresa el artista y la canción que quieres priorizar.');
return;
}
if (confirm(`¿Quieres usar 500 LP para que "${artist} - ${song}" suene ahora mismo?`)) {
const btn = document.getElementById('vip-jump-btn');
btn.disabled = true;
btn.innerHTML = '<i class="bi bi-hourglass-split"></i>...';
try {
const response = await fetch('api/redeem.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username: requester,
item: 'vip_jump',
artist: artist,
song: song
})
});
const result = await response.json();
if (result.success) {
confetti({
particleCount: 300,
spread: 120,
origin: { y: 0.6 },
colors: ['#00e676', '#facc15', '#ffffff']
});
alert(result.message);
artistInput.value = '';
songInput.value = '';
fetchSongRequests();
fetchLeaderboard();
} else {
alert('Error: ' + result.error);
}
} catch (error) {
console.error('VIP Jump error:', error);
alert('Error de conexión.');
} finally {
btn.disabled = false;
btn.innerHTML = '<i class="bi bi-lightning-charge-fill"></i> VIP JUMP';
}
}
}
async function redeemItem(item, color = null, artist = null, song = null) {
const userName = document.getElementById('user-name').value.trim();
if (!userName) return;
try {
const response = await fetch('api/redeem.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username: userName,
item: item,
color: color,
artist: artist,
song: song
})
});
const result = await response.json();
if (result.success) {
confetti({
particleCount: 200,
spread: 100,
origin: { y: 0.6 },
colors: ['#facc15', '#f472b6', '#38bdf8', '#ffffff']
});
alert(result.message);
closeShopModal();
fetchLeaderboard();
if (typeof fetchMessages === 'function') fetchMessages();
if (item === 'vip_jump') fetchSongRequests();
} else {
alert('Error: ' + result.error);
}
} catch (error) {
console.error('Redeem error:', error);
alert('Error de conexión al realizar el canje.');
}
}
setInterval(fetchActivePerks, 10000);
fetchActivePerks();
// --- End Radio Shop Functionality ---