![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/401cd17b/ |
<?php
session_start();
require_once 'config/database.php';
// Get the "fun fun" track
$pdo = getDBConnection();
$stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE title LIKE '%fun fun%' AND status = 'complete' LIMIT 1");
$stmt->execute();
$fun_fun_track = $stmt->fetch();
if (!$fun_fun_track) {
echo "<h1>❌ Fun Fun Track Not Found</h1>";
echo "<p>The 'fun fun' track is not available or not complete.</p>";
exit;
}
// Get user info for the track
$stmt = $pdo->prepare("SELECT name FROM users WHERE id = ?");
$stmt->execute([$fun_fun_track['user_id']]);
$user = $stmt->fetch();
$artist_name = $user ? $user['name'] : 'Unknown Artist';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Final Test - Fun Fun Track Fix</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background: #1a1a1a;
color: white;
}
.test-container {
background: #333;
padding: 20px;
margin: 20px 0;
border-radius: 8px;
}
.track-card {
background: #444;
padding: 20px;
border-radius: 8px;
margin: 20px 0;
}
.track-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
}
.track-artist {
color: #ccc;
margin-bottom: 10px;
}
.track-prompt {
color: #aaa;
margin-bottom: 15px;
}
.track-actions {
display: flex;
gap: 10px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 5px;
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-secondary {
background: #666;
color: white;
}
.status {
padding: 10px;
border-radius: 4px;
margin: 10px 0;
}
.status.success {
background: #28a745;
color: white;
}
.status.error {
background: #dc3545;
color: white;
}
.status.info {
background: #17a2b8;
color: white;
}
.fix-summary {
background: #28a745;
color: white;
padding: 15px;
border-radius: 8px;
margin: 20px 0;
}
</style>
</head>
<body>
<h1>🎵 Final Test - Fun Fun Track Fix</h1>
<div class="fix-summary">
<h2>✅ FIXES APPLIED</h2>
<ul>
<li><strong>Library Page:</strong> Removed `onclick` and added proper event listeners with `stopImmediatePropagation()`</li>
<li><strong>Dashboard Page:</strong> Removed `onclick` and added proper event listeners with `stopImmediatePropagation()`</li>
<li><strong>Community Page:</strong> Already had correct implementation</li>
<li><strong>Global Player:</strong> Included for all AJAX requests</li>
</ul>
</div>
<div class="test-container">
<h2>🎵 Fun Fun Track (Library Style)</h2>
<div class="track-card">
<div class="track-title"><?= htmlspecialchars($fun_fun_track['title']) ?></div>
<div class="track-artist">by <?= htmlspecialchars($artist_name) ?></div>
<div class="track-prompt"><?= htmlspecialchars(substr($fun_fun_track['prompt'], 0, 100)) ?>...</div>
<div class="track-actions">
<button class="btn btn-primary play-track-btn"
data-audio-url="<?= htmlspecialchars($fun_fun_track['audio_url']) ?>"
data-title="<?= htmlspecialchars($fun_fun_track['title']) ?>"
data-artist="<?= htmlspecialchars($artist_name) ?>"
data-track-id="<?= $fun_fun_track['id'] ?>">
<i class="fas fa-play"></i> Play
</button>
<button class="btn btn-secondary" onclick="testGlobalPlayer()">
<i class="fas fa-cog"></i> Test Global Player
</button>
</div>
</div>
</div>
<div class="test-container">
<h2>📋 Test Instructions</h2>
<ol>
<li>Click the "Play" button above - it should use the bottom global player</li>
<li>Check that the global player at the bottom shows "fun fun" track info</li>
<li>Verify that the play/pause controls work in the global player</li>
<li>Test that the volume control works</li>
<li>Check the browser console for "🎵 Play button clicked!" message</li>
<li>Navigate to the actual library page and test the "fun fun" track there</li>
</ol>
</div>
<div class="test-container">
<h2>🔍 Debug Info</h2>
<div id="debugInfo" class="status info">
<strong>Track ID:</strong> <?= $fun_fun_track['id'] ?><br>
<strong>Audio URL:</strong> <?= htmlspecialchars($fun_fun_track['audio_url']) ?><br>
<strong>Status:</strong> <?= $fun_fun_track['status'] ?><br>
<strong>Artist:</strong> <?= htmlspecialchars($artist_name) ?><br>
<strong>User ID:</strong> <?= $fun_fun_track['user_id'] ?>
</div>
</div>
<div class="test-container">
<h2>🔗 Navigation</h2>
<a href="/library_new.php" class="btn btn-primary">Go to Library Page</a>
<a href="/dashboard.php" class="btn btn-secondary">Go to Dashboard</a>
<a href="/community.php" class="btn btn-secondary">Go to Community</a>
</div>
<script>
// Test global player function
function testGlobalPlayer() {
console.log('🎵 Testing global player...');
if (typeof window.globalPlayer !== 'undefined') {
console.log('✅ Global player exists');
document.getElementById('debugInfo').innerHTML += '<br><strong>✅ Global player exists</strong>';
if (typeof window.globalPlayer.playTrack === 'function') {
console.log('✅ Global player playTrack function exists');
document.getElementById('debugInfo').innerHTML += '<br><strong>✅ Global player playTrack function exists</strong>';
} else {
console.error('❌ Global player playTrack function missing');
document.getElementById('debugInfo').innerHTML += '<br><strong>❌ Global player playTrack function missing</strong>';
}
} else {
console.error('❌ Global player not found');
document.getElementById('debugInfo').innerHTML += '<br><strong>❌ Global player not found</strong>';
}
}
// Setup play button event listeners (same as library page)
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.play-track-btn').forEach(button => {
button.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
const audioUrl = this.getAttribute('data-audio-url');
const title = this.getAttribute('data-title');
const artist = this.getAttribute('data-artist');
const trackId = this.getAttribute('data-track-id');
console.log('🎵 Play button clicked:', { audioUrl, title, artist, trackId });
// Validate audio URL
if (!audioUrl || audioUrl === 'NULL' || audioUrl === 'null') {
alert('This track is not available for playback.');
return;
}
// Use the global player function
if (typeof window.playTrackWithGlobalPlayer === 'function') {
window.playTrackWithGlobalPlayer(audioUrl, title, artist, <?= $_SESSION['user_id'] ?>);
} else if (typeof window.globalPlayer !== 'undefined' && typeof window.globalPlayer.playTrack === 'function') {
window.globalPlayer.playTrack(audioUrl, title, artist, <?= $_SESSION['user_id'] ?>);
} else {
console.error('❌ Global player function not available');
alert('Global player not available. Please refresh the page.');
}
});
});
});
</script>
<?php include 'includes/global_player.php'; ?>
</body>
</html>