![]() 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
// Update database to use natural audiofiles URLs
require_once 'config/database.php';
echo "<h1>🎵 Update to Audiofiles URLs</h1>";
$pdo = getDBConnection();
if (!$pdo) {
echo "<p style='color: red;'>❌ Database connection failed!</p>";
exit;
}
// Find tracks with proxy URLs
$stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE audio_url LIKE '%audio_proxy%' AND status = 'complete' ORDER BY created_at DESC");
$stmt->execute();
$tracks = $stmt->fetchAll();
if (empty($tracks)) {
echo "<p style='color: orange;'>⚠️ No tracks found with proxy URLs</p>";
} else {
echo "<p style='color: green;'>✅ Found " . count($tracks) . " track(s) to update:</p>";
foreach ($tracks as $track) {
echo "<div style='border: 1px solid #ccc; padding: 15px; margin: 10px 0; border-radius: 5px;'>";
echo "<h3>" . htmlspecialchars($track['title']) . "</h3>";
echo "<p><strong>Task ID:</strong> " . $track['task_id'] . "</p>";
echo "<p><strong>Old URL:</strong> " . htmlspecialchars($track['audio_url']) . "</p>";
// Create natural audiofiles URL
$audiofilesUrl = '/audiofiles.php?id=' . $track['task_id'];
echo "<p><strong>New URL:</strong> " . htmlspecialchars($audiofilesUrl) . "</p>";
// Update database
$updateStmt = $pdo->prepare("UPDATE music_tracks SET audio_url = ? WHERE id = ?");
$result = $updateStmt->execute([$audiofilesUrl, $track['id']]);
if ($result) {
echo "<p style='color: green;'>✅ Updated to audiofiles URL</p>";
echo "<p><strong>Test Link:</strong> <a href='" . htmlspecialchars($audiofilesUrl) . "' target='_blank'>Play Audio</a></p>";
} else {
echo "<p style='color: red;'>❌ Failed to update database</p>";
}
echo "</div>";
}
}
// Show all tracks after update
echo "<h2>🎵 All Tracks After Update:</h2>";
$stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE status = 'complete' ORDER BY created_at DESC");
$stmt->execute();
$allTracks = $stmt->fetchAll();
if (empty($allTracks)) {
echo "<p style='color: orange;'>⚠️ No complete tracks found</p>";
} else {
echo "<p style='color: green;'>✅ Found " . count($allTracks) . " complete track(s):</p>";
foreach ($allTracks as $track) {
echo "<div style='border: 1px solid #ccc; padding: 15px; margin: 10px 0; border-radius: 5px;'>";
echo "<h3>" . htmlspecialchars($track['title']) . "</h3>";
echo "<p><strong>Status:</strong> " . $track['status'] . "</p>";
echo "<p><strong>Audio URL:</strong> " . ($track['audio_url'] ? "<a href='" . htmlspecialchars($track['audio_url']) . "' target='_blank'>" . htmlspecialchars($track['audio_url']) . "</a>" : "None") . "</p>";
echo "<p><strong>Created:</strong> " . $track['created_at'] . "</p>";
echo "</div>";
}
}
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>";
?>