![]() 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
// Debug script to check track information
session_start();
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo "š DEBUGGING TRACK: 8cd1c23483097cc26fac73049ea0302d\n\n";
// Include database configuration
require_once 'config/database.php';
$pdo = getDBConnection();
if (!$pdo) {
echo "ā Database connection failed\n";
exit;
}
$taskId = '8cd1c23483097cc26fac73049ea0302d';
// Check if track exists
$stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE task_id = ?");
$stmt->execute([$taskId]);
$track = $stmt->fetch();
if (!$track) {
echo "ā Track not found in database\n";
echo "Task ID: " . $taskId . "\n";
// Show all tracks for debugging
echo "\nš ALL TRACKS IN DATABASE:\n";
$stmt = $pdo->prepare("SELECT task_id, title, status, audio_url FROM music_tracks ORDER BY created_at DESC LIMIT 10");
$stmt->execute();
$tracks = $stmt->fetchAll();
foreach ($tracks as $t) {
echo "Task ID: " . $t['task_id'] . "\n";
echo "Title: " . $t['title'] . "\n";
echo "Status: " . $t['status'] . "\n";
echo "Audio URL: " . $t['audio_url'] . "\n";
echo "---\n";
}
exit;
}
echo "ā
Track found in database:\n";
echo "ID: " . $track['id'] . "\n";
echo "Task ID: " . $track['task_id'] . "\n";
echo "Title: " . $track['title'] . "\n";
echo "Status: " . $track['status'] . "\n";
echo "Audio URL: " . $track['audio_url'] . "\n";
echo "User ID: " . $track['user_id'] . "\n";
echo "Created: " . $track['created_at'] . "\n\n";
// Check if user is logged in
if (isset($_SESSION['user_id'])) {
echo "š¤ Current user ID: " . $_SESSION['user_id'] . "\n";
echo "Track user ID: " . $track['user_id'] . "\n";
if ($_SESSION['user_id'] == $track['user_id']) {
echo "ā
User owns this track\n";
} else {
echo "ā User does not own this track\n";
}
} else {
echo "ā No user logged in\n";
}
// Check if audio URL is accessible
$audioUrl = $track['audio_url'];
echo "\nš AUDIO URL ANALYSIS:\n";
echo "URL: " . $audioUrl . "\n";
if (empty($audioUrl)) {
echo "ā Audio URL is empty\n";
} else {
// Check if it's a local file
if (strpos($audioUrl, '/audio_files/') === 0) {
$localPath = '.' . $audioUrl;
echo "Local path: " . $localPath . "\n";
if (file_exists($localPath)) {
echo "ā
Local file exists\n";
echo "File size: " . filesize($localPath) . " bytes\n";
echo "File type: " . mime_content_type($localPath) . "\n";
} else {
echo "ā Local file does not exist\n";
}
}
// Check if it's an external URL
if (strpos($audioUrl, 'http') === 0) {
echo "š External URL detected\n";
// Test URL accessibility
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $audioUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch);
echo "HTTP Code: " . $httpCode . "\n";
if ($curlError) {
echo "ā cURL Error: " . $curlError . "\n";
} else {
if ($httpCode == 200) {
echo "ā
URL is accessible\n";
echo "Response size: " . strlen($response) . " bytes\n";
} else {
echo "ā URL returned HTTP " . $httpCode . "\n";
}
}
}
}
echo "\nš§ POSSIBLE ISSUES:\n";
echo "1. Track status is not 'complete'\n";
echo "2. User doesn't own the track\n";
echo "3. Audio URL is empty or invalid\n";
echo "4. External URL is not accessible\n";
echo "5. Local file doesn't exist\n";
echo "\nš” SUGGESTED FIXES:\n";
echo "1. Check if track status is 'complete'\n";
echo "2. Verify user ownership\n";
echo "3. Update audio URL if needed\n";
echo "4. Test external URL accessibility\n";
echo "5. Ensure local files exist\n";
?>