![]() 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/-2c51147a/ |
<?php
// Debug artist name issue for new tracks
require_once 'config/database.php';
$pdo = getDBConnection();
echo "<h2>Debug Artist Name Issue</h2>";
// Check recent tracks and their artist info
$recent_tracks = $pdo->query("
SELECT mt.id, mt.title, mt.user_id, mt.status, mt.created_at, u.name as artist_name
FROM music_tracks mt
LEFT JOIN users u ON mt.user_id = u.id
ORDER BY mt.created_at DESC
LIMIT 10
")->fetchAll();
echo "<h3>Recent Tracks:</h3>";
foreach ($recent_tracks as $track) {
echo "<div style='border: 1px solid #ccc; padding: 10px; margin: 10px;'>";
echo "<strong>ID:</strong> " . $track['id'] . "<br>";
echo "<strong>Title:</strong> " . htmlspecialchars($track['title']) . "<br>";
echo "<strong>User ID:</strong> " . $track['user_id'] . "<br>";
echo "<strong>Artist Name:</strong> " . htmlspecialchars($track['artist_name'] ?? 'NULL') . "<br>";
echo "<strong>Status:</strong> " . $track['status'] . "<br>";
echo "<strong>Created:</strong> " . $track['created_at'] . "<br>";
echo "</div>";
}
// Check if there are any tracks with NULL artist names
$null_artist_tracks = $pdo->query("
SELECT mt.id, mt.title, mt.user_id, u.name as artist_name
FROM music_tracks mt
LEFT JOIN users u ON mt.user_id = u.id
WHERE u.name IS NULL AND mt.user_id IS NOT NULL
ORDER BY mt.created_at DESC
LIMIT 5
")->fetchAll();
if (!empty($null_artist_tracks)) {
echo "<h3>⚠️ Tracks with NULL Artist Names:</h3>";
foreach ($null_artist_tracks as $track) {
echo "<div style='border: 1px solid red; padding: 10px; margin: 10px; background: #fee;'>";
echo "<strong>ID:</strong> " . $track['id'] . "<br>";
echo "<strong>Title:</strong> " . htmlspecialchars($track['title']) . "<br>";
echo "<strong>User ID:</strong> " . $track['user_id'] . "<br>";
echo "<strong>Artist Name:</strong> " . htmlspecialchars($track['artist_name'] ?? 'NULL') . "<br>";
echo "</div>";
}
// Check if the user exists
foreach ($null_artist_tracks as $track) {
$user = $pdo->query("SELECT * FROM users WHERE id = " . $track['user_id'])->fetch();
echo "<div style='border: 1px solid orange; padding: 10px; margin: 10px; background: #fff3cd;'>";
echo "<strong>User Check for ID " . $track['user_id'] . ":</strong><br>";
if ($user) {
echo "✅ User exists: " . htmlspecialchars($user['name']) . "<br>";
} else {
echo "❌ User does not exist!<br>";
}
echo "</div>";
}
} else {
echo "<h3>✅ No tracks with NULL artist names found</h3>";
}
// Check admin user
$admin_user = $pdo->query("SELECT * FROM users WHERE is_admin = 1 LIMIT 1")->fetch();
echo "<h3>Admin User Check:</h3>";
if ($admin_user) {
echo "<div style='border: 1px solid green; padding: 10px; margin: 10px; background: #d4edda;'>";
echo "✅ Admin user found:<br>";
echo "<strong>ID:</strong> " . $admin_user['id'] . "<br>";
echo "<strong>Name:</strong> " . htmlspecialchars($admin_user['name']) . "<br>";
echo "<strong>Is Admin:</strong> " . ($admin_user['is_admin'] ? 'Yes' : 'No') . "<br>";
echo "</div>";
} else {
echo "<div style='border: 1px solid red; padding: 10px; margin: 10px; background: #fee;'>";
echo "❌ No admin user found!";
echo "</div>";
}
// Test the global player query
echo "<h3>Global Player Query Test:</h3>";
$global_player_tracks = $pdo->query("
SELECT mt.*, u.name as artist_name
FROM music_tracks mt
JOIN users u ON mt.user_id = u.id
WHERE mt.status = 'complete' AND mt.audio_url IS NOT NULL
ORDER BY mt.created_at DESC
LIMIT 5
")->fetchAll();
foreach ($global_player_tracks as $track) {
echo "<div style='border: 1px solid blue; padding: 10px; margin: 10px; background: #e3f2fd;'>";
echo "<strong>Global Player Track:</strong><br>";
echo "<strong>Title:</strong> " . htmlspecialchars($track['title']) . "<br>";
echo "<strong>Artist:</strong> " . htmlspecialchars($track['artist_name']) . "<br>";
echo "<strong>User ID:</strong> " . $track['user_id'] . "<br>";
echo "</div>";
}
?>