![]() 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/-ae3ae2/ |
<?php
session_start();
require_once 'config/database.php';
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
echo "Please log in first";
exit;
}
$pdo = getDBConnection();
if (!$pdo) {
echo "Database connection failed";
exit;
}
echo "<h2>🔍 Audio Variations Debug</h2>";
// Check table structure
echo "<h3>📋 Table Structure:</h3>";
try {
$stmt = $pdo->query("DESCRIBE audio_variations");
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>";
echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th><th>Extra</th></tr>";
foreach ($columns as $col) {
echo "<tr>";
echo "<td>{$col['Field']}</td>";
echo "<td>{$col['Type']}</td>";
echo "<td>{$col['Null']}</td>";
echo "<td>{$col['Key']}</td>";
echo "<td>{$col['Default']}</td>";
echo "<td>{$col['Extra']}</td>";
echo "</tr>";
}
echo "</table>";
} catch (Exception $e) {
echo "Error describing table: " . $e->getMessage();
}
// Check if table has data
echo "<h3>📊 Table Data:</h3>";
try {
$stmt = $pdo->query("SELECT COUNT(*) as total FROM audio_variations");
$count = $stmt->fetch(PDO::FETCH_ASSOC);
echo "<p>Total variations in database: <strong>{$count['total']}</strong></p>";
if ($count['total'] > 0) {
$stmt = $pdo->query("SELECT * FROM audio_variations LIMIT 10");
$variations = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>";
echo "<tr><th>ID</th><th>Track ID</th><th>Variation Index</th><th>Audio URL</th><th>Duration</th><th>Title</th><th>Created</th></tr>";
foreach ($variations as $var) {
echo "<tr>";
echo "<td>{$var['id']}</td>";
echo "<td>{$var['track_id']}</td>";
echo "<td>{$var['variation_index']}</td>";
echo "<td>" . substr($var['audio_url'] ?? 'NULL', 0, 50) . "...</td>";
echo "<td>{$var['duration']}</td>";
echo "<td>{$var['title']}</td>";
echo "<td>{$var['created_at']}</td>";
echo "</tr>";
}
echo "</table>";
}
} catch (Exception $e) {
echo "Error checking data: " . $e->getMessage();
}
// Check user's tracks
echo "<h3>🎵 User's Tracks:</h3>";
try {
$stmt = $pdo->prepare("SELECT id, title, status, audio_url FROM music_tracks WHERE user_id = ? ORDER BY created_at DESC LIMIT 5");
$stmt->execute([$_SESSION['user_id']]);
$tracks = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (empty($tracks)) {
echo "<p>No tracks found for this user</p>";
} else {
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>";
echo "<tr><th>ID</th><th>Title</th><th>Status</th><th>Audio URL</th></tr>";
foreach ($tracks as $track) {
echo "<tr>";
echo "<td>{$track['id']}</td>";
echo "<td>{$track['title']}</td>";
echo "<td>{$track['status']}</td>";
echo "<td>" . substr($track['audio_url'] ?? 'NULL', 0, 50) . "...</td>";
echo "</tr>";
}
echo "</table>";
// Check variations for first track
if (!empty($tracks)) {
$first_track_id = $tracks[0]['id'];
echo "<h4>🔍 Variations for Track ID {$first_track_id}:</h4>";
$stmt = $pdo->prepare("SELECT * FROM audio_variations WHERE track_id = ?");
$stmt->execute([$first_track_id]);
$track_variations = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (empty($track_variations)) {
echo "<p>No variations found for this track</p>";
} else {
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>";
echo "<tr><th>ID</th><th>Variation Index</th><th>Audio URL</th><th>Created</th></tr>";
foreach ($track_variations as $var) {
echo "<tr>";
echo "<td>{$var['id']}</td>";
echo "<td>{$var['variation_index']}</td>";
echo "<td>" . substr($var['audio_url'] ?? 'NULL', 0, 50) . "...</td>";
echo "<td>{$var['created_at']}</td>";
echo "</tr>";
}
echo "</table>";
}
}
}
} catch (Exception $e) {
echo "Error checking user tracks: " . $e->getMessage();
}
echo "<hr>";
echo "<p><a href='library.php'>← Back to Library</a></p>";
?>