![]() 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/575aa17f/ |
<?php
require_once 'config/database.php';
try {
$pdo = getDBConnection();
echo "<h2>๐ First Track Debug - Adagio for Strings</h2>\n";
// Get the first track specifically
$stmt = $pdo->prepare("
SELECT
mt.id,
mt.title,
mt.audio_url,
mt.video_url,
mt.status,
mt.is_vip_sample,
mt.is_featured,
mt.playlist_order,
mt.created_at,
u.name as artist_name,
u.id as user_id,
(SELECT COUNT(*) FROM track_plays WHERE track_id = mt.id) as play_count,
(SELECT COUNT(*) FROM track_likes WHERE track_id = mt.id) as like_count
FROM music_tracks mt
JOIN users u ON mt.user_id = u.id
WHERE mt.id = 44
");
$stmt->execute();
$track = $stmt->fetch();
if ($track) {
echo "<h3>๐ต Track Details:</h3>\n";
echo "<ul>\n";
echo "<li><strong>ID:</strong> {$track['id']}</li>\n";
echo "<li><strong>Title:</strong> '{$track['title']}'</li>\n";
echo "<li><strong>Artist:</strong> {$track['artist_name']}</li>\n";
echo "<li><strong>Status:</strong> {$track['status']}</li>\n";
echo "<li><strong>VIP Sample:</strong> " . ($track['is_vip_sample'] ? 'Yes' : 'No') . "</li>\n";
echo "<li><strong>Featured:</strong> " . ($track['is_featured'] ? 'Yes' : 'No') . "</li>\n";
echo "<li><strong>Playlist Order:</strong> {$track['playlist_order']}</li>\n";
echo "<li><strong>Audio URL:</strong> " . (empty($track['audio_url']) ? 'NULL' : 'Present') . "</li>\n";
echo "<li><strong>Play Count:</strong> {$track['play_count']}</li>\n";
echo "<li><strong>Like Count:</strong> {$track['like_count']}</li>\n";
echo "</ul>\n";
if (!empty($track['audio_url'])) {
echo "<h3>๐ Audio URL Test:</h3>\n";
echo "<p><strong>URL:</strong> {$track['audio_url']}</p>\n";
// Test if the URL is accessible
$headers = get_headers($track['audio_url'], 1);
if ($headers) {
echo "<p><strong>HTTP Status:</strong> " . $headers[0] . "</p>\n";
if (strpos($headers[0], '200') !== false) {
echo "<p style='color: green;'>โ
Audio URL is accessible</p>\n";
} else {
echo "<p style='color: red;'>โ Audio URL returned status: " . $headers[0] . "</p>\n";
}
} else {
echo "<p style='color: red;'>โ Could not access audio URL</p>\n";
}
} else {
echo "<p style='color: red;'>โ Audio URL is NULL or empty!</p>\n";
}
// Test the VIP API response for this specific track
echo "<h3>๐งช VIP API Test:</h3>\n";
$stmt = $pdo->prepare("
SELECT
mt.id,
mt.title,
mt.audio_url,
mt.created_at,
mt.playlist_order,
u.name as artist_name,
u.id as user_id,
(SELECT COUNT(*) FROM track_plays WHERE track_id = mt.id) as play_count,
(SELECT COUNT(*) FROM track_likes WHERE track_id = mt.id) as like_count
FROM music_tracks mt
JOIN users u ON mt.user_id = u.id
WHERE mt.status = 'complete'
AND mt.audio_url IS NOT NULL
AND mt.is_vip_sample = 1
ORDER BY mt.playlist_order ASC, mt.created_at DESC
LIMIT 5
");
$stmt->execute();
$vip_tracks = $stmt->fetchAll();
echo "<p><strong>First 5 VIP tracks:</strong></p>\n";
echo "<ol>\n";
foreach ($vip_tracks as $index => $vip_track) {
$status = ($vip_track['id'] == 44) ? ' <strong style="color: green;">(FIRST TRACK)</strong>' : '';
echo "<li>ID {$vip_track['id']}: '{$vip_track['title']}' by {$vip_track['artist_name']} (Order: {$vip_track['playlist_order']}){$status}</li>\n";
}
echo "</ol>\n";
// Check if this track is actually first in the playlist
if ($vip_tracks[0]['id'] == 44) {
echo "<p style='color: green;'>โ
Track ID 44 is correctly the first track in VIP playlist</p>\n";
} else {
echo "<p style='color: red;'>โ Track ID 44 is NOT the first track! First track is ID {$vip_tracks[0]['id']}</p>\n";
}
} else {
echo "<p style='color: red;'>โ Track ID 44 not found!</p>\n";
}
// Test the actual API endpoint
echo "<h3>๐ API Endpoint Test:</h3>\n";
$api_url = '/api/get_vip_sample_tracks.php?per_page=10';
echo "<p>Testing: <code>$api_url</code></p>\n";
// Simulate the API call
$stmt = $pdo->prepare("
SELECT
mt.id,
mt.title,
mt.audio_url,
mt.video_url,
mt.prompt,
mt.created_at,
mt.playlist_order,
u.name as artist_name,
u.id as user_id,
(SELECT COUNT(*) FROM track_plays WHERE track_id = mt.id) as play_count,
(SELECT COUNT(*) FROM track_likes WHERE track_id = mt.id) as like_count
FROM music_tracks mt
JOIN users u ON mt.user_id = u.id
WHERE mt.status = 'complete'
AND mt.audio_url IS NOT NULL
AND mt.is_vip_sample = 1
ORDER BY mt.playlist_order ASC, mt.created_at DESC
LIMIT 10
");
$stmt->execute();
$api_tracks = $stmt->fetchAll();
echo "<p><strong>API Response (first 3 tracks):</strong></p>\n";
echo "<pre>";
foreach (array_slice($api_tracks, 0, 3) as $track) {
echo "ID {$track['id']}: '{$track['title']}' by {$track['artist_name']}\n";
echo " Audio URL: {$track['audio_url']}\n";
echo " Playlist Order: {$track['playlist_order']}\n\n";
}
echo "</pre>";
echo "<h3>๐ฎ Manual Debug Steps:</h3>\n";
echo "<ol>\n";
echo "<li>Go to homepage and open browser console (F12)</li>\n";
echo "<li>Run: <code>window.refreshCurrentPlaylist()</code></li>\n";
echo "<li>Check console for any error messages</li>\n";
echo "<li>Try clicking play on the global player</li>\n";
echo "<li>If it fails, check the network tab for failed requests</li>\n";
echo "</ol>\n";
} catch (Exception $e) {
echo "<p style='color: red;'>โ Error: " . $e->getMessage() . "</p>\n";
}
?>