![]() 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/domains/soundstudiopro.com/private_html/utils/ |
<?php
session_start();
require_once 'config/database.php';
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
echo "<p>Please <a href='/auth/login.php'>login first</a></p>";
exit;
}
echo "<h1>🔍 Finding Your Danny Song</h1>";
echo "<p><strong>User:</strong> " . $_SESSION['user_name'] . " (ID: " . $_SESSION['user_id'] . ")</p>";
// Get database connection
$pdo = getDBConnection();
if (!$pdo) {
echo "<p style='color: red;'>❌ Database connection failed!</p>";
exit;
}
// 1. Check for tracks with "danny" in the prompt
echo "<h2>1. Tracks with 'danny' in prompt:</h2>";
$stmt = $pdo->prepare("
SELECT id, title, prompt, status, created_at, audio_url
FROM music_tracks
WHERE user_id = ? AND prompt LIKE ?
ORDER BY created_at DESC
");
$stmt->execute([$_SESSION['user_id'], '%danny%']);
$dannyTracks = $stmt->fetchAll();
if (empty($dannyTracks)) {
echo "<p style='color: orange;'>⚠️ No tracks found with 'danny' in the prompt</p>";
} else {
echo "<p style='color: green;'>✅ Found " . count($dannyTracks) . " tracks with 'danny':</p>";
echo "<table border='1' style='border-collapse: collapse; width: 100%; margin: 1rem 0;'>";
echo "<tr><th>ID</th><th>Title</th><th>Prompt</th><th>Status</th><th>Created</th><th>Audio URL</th></tr>";
foreach ($dannyTracks as $track) {
echo "<tr>";
echo "<td>" . $track['id'] . "</td>";
echo "<td>" . htmlspecialchars($track['title']) . "</td>";
echo "<td>" . htmlspecialchars(substr($track['prompt'], 0, 50)) . "...</td>";
echo "<td>" . $track['status'] . "</td>";
echo "<td>" . $track['created_at'] . "</td>";
echo "<td>" . ($track['audio_url'] ? 'Yes' : 'No') . "</td>";
echo "</tr>";
}
echo "</table>";
}
// 2. Check all recent tracks
echo "<h2>2. All your recent tracks:</h2>";
$stmt = $pdo->prepare("
SELECT id, title, prompt, status, created_at, audio_url
FROM music_tracks
WHERE user_id = ?
ORDER BY created_at DESC
LIMIT 10
");
$stmt->execute([$_SESSION['user_id']]);
$recentTracks = $stmt->fetchAll();
if (empty($recentTracks)) {
echo "<p style='color: orange;'>⚠️ No tracks found at all</p>";
} else {
echo "<p style='color: green;'>✅ Found " . count($recentTracks) . " recent tracks:</p>";
echo "<table border='1' style='border-collapse: collapse; width: 100%; margin: 1rem 0;'>";
echo "<tr><th>ID</th><th>Title</th><th>Prompt</th><th>Status</th><th>Created</th><th>Audio URL</th></tr>";
foreach ($recentTracks as $track) {
$highlight = strpos(strtolower($track['prompt']), 'danny') !== false ? 'background: yellow; color: black;' : '';
echo "<tr style='$highlight'>";
echo "<td>" . $track['id'] . "</td>";
echo "<td>" . htmlspecialchars($track['title']) . "</td>";
echo "<td>" . htmlspecialchars(substr($track['prompt'], 0, 50)) . "...</td>";
echo "<td>" . $track['status'] . "</td>";
echo "<td>" . $track['created_at'] . "</td>";
echo "<td>" . ($track['audio_url'] ? 'Yes' : 'No') . "</td>";
echo "</tr>";
}
echo "</table>";
}
// 3. Check processing tracks
echo "<h2>3. Processing tracks:</h2>";
$stmt = $pdo->prepare("
SELECT id, title, prompt, created_at
FROM music_tracks
WHERE user_id = ? AND status = 'processing'
ORDER BY created_at DESC
");
$stmt->execute([$_SESSION['user_id']]);
$processingTracks = $stmt->fetchAll();
if (empty($processingTracks)) {
echo "<p style='color: green;'>✅ No tracks currently processing</p>";
} else {
echo "<p style='color: orange;'>⚠️ Found " . count($processingTracks) . " tracks still processing:</p>";
echo "<ul>";
foreach ($processingTracks as $track) {
echo "<li><strong>" . htmlspecialchars($track['title']) . "</strong> - " . $track['created_at'] . "</li>";
}
echo "</ul>";
}
// 4. Check callback log
echo "<h2>4. Recent API activity:</h2>";
$logFile = 'callback_log.txt';
if (file_exists($logFile)) {
$logContent = file_get_contents($logFile);
$lines = explode("\n", $logContent);
$recentLines = array_slice($lines, -5); // Last 5 lines
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 200px; overflow-y: auto; color: black;'>";
foreach ($recentLines as $line) {
if (trim($line)) {
echo htmlspecialchars($line) . "\n";
}
}
echo "</pre>";
} else {
echo "<p>No callback log found</p>";
}
// 5. Check task results directory
echo "<h2>5. Task results files:</h2>";
$taskResultsDir = 'task_results';
if (is_dir($taskResultsDir)) {
$files = scandir($taskResultsDir);
$jsonFiles = array_filter($files, function($file) {
return pathinfo($file, PATHINFO_EXTENSION) === 'json';
});
if (empty($jsonFiles)) {
echo "<p>No task result files found</p>";
} else {
echo "<p>Found " . count($jsonFiles) . " task result files:</p>";
echo "<ul>";
foreach (array_slice($jsonFiles, -5) as $file) { // Last 5 files
echo "<li>$file</li>";
}
echo "</ul>";
}
} else {
echo "<p>Task results directory not found</p>";
}
echo "<h2>🔧 Quick Actions:</h2>";
echo "<p><a href='/library.php' style='background: #667eea; color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 5px; margin-right: 1rem;'>📚 Go to Library</a>";
echo "<a href='/create.php' style='background: #48bb78; color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 5px; margin-right: 1rem;'>🎵 Create New Music</a>";
echo "<a href='/dashboard.php' style='background: #764ba2; color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 5px;'>🏠 Back to Dashboard</a></p>";
echo "<h2>💡 Possible Issues:</h2>";
echo "<ul>";
echo "<li><strong>Processing Status:</strong> If your song shows 'processing', it's still being generated by the AI</li>";
echo "<li><strong>Different Prompt:</strong> Maybe you used different words than 'danny'</li>";
echo "<li><strong>API Error:</strong> The music creation might have failed</li>";
echo "<li><strong>Database Issue:</strong> The track might not have been saved properly</li>";
echo "</ul>";
?>