![]() 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/2595d677/ |
<?php
require_once 'config/database.php';
$pdo = getDBConnection();
if (!$pdo) {
die("Database connection failed");
}
echo "<h2>Fixing Erik Sarmiento's Track</h2>";
try {
// Get Erik's user ID
$stmt = $pdo->prepare("SELECT id, name FROM users WHERE name = ?");
$stmt->execute(['Erik Sarmiento']);
$user = $stmt->fetch();
if (!$user) {
echo "<p>❌ User 'Erik Sarmiento' not found</p>";
exit;
}
echo "<p>✅ User found: ID {$user['id']}, Name: {$user['name']}</p>";
// Get Erik's track that has test.mp3
$stmt = $pdo->prepare("
SELECT id, title, audio_url, status
FROM music_tracks
WHERE user_id = ? AND audio_url = '/audio_files/test.mp3'
LIMIT 1
");
$stmt->execute([$user['id']]);
$track = $stmt->fetch();
if (!$track) {
echo "<p>❌ No track with test.mp3 found for Erik</p>";
exit;
}
echo "<p>🔍 Found track to fix:</p>";
echo "<ul>";
echo "<li>ID: {$track['id']}</li>";
echo "<li>Title: " . htmlspecialchars($track['title']) . "</li>";
echo "<li>Current Audio URL: {$track['audio_url']}</li>";
echo "<li>Status: {$track['status']}</li>";
echo "</ul>";
// Find a real audio file to use
$audioFiles = glob('audio_files/*.mp3');
if (empty($audioFiles)) {
echo "<p>❌ No audio files found in audio_files/ directory</p>";
exit;
}
// Use the first available audio file
$realAudioFile = $audioFiles[0];
$newAudioUrl = '/' . $realAudioFile;
echo "<p>📁 Found real audio file: {$realAudioFile}</p>";
echo "<p>🔄 New audio URL: {$newAudioUrl}</p>";
// Update the track
$stmt = $pdo->prepare("
UPDATE music_tracks
SET audio_url = ?, title = ?
WHERE id = ?
");
$newTitle = 'Untitled Track'; // Give it a proper title
$result = $stmt->execute([$newAudioUrl, $newTitle, $track['id']]);
if ($result) {
echo "<p>✅ Track updated successfully!</p>";
echo "<ul>";
echo "<li>New Title: {$newTitle}</li>";
echo "<li>New Audio URL: {$newAudioUrl}</li>";
echo "</ul>";
// Verify the update
$stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE id = ?");
$stmt->execute([$track['id']]);
$updatedTrack = $stmt->fetch();
echo "<h3>Updated Track Data:</h3>";
echo "<pre>" . print_r($updatedTrack, true) . "</pre>";
} else {
echo "<p>❌ Failed to update track</p>";
}
} catch (Exception $e) {
echo "<p>❌ Error: " . $e->getMessage() . "</p>";
}
?>