T.ME/BIBIL_0DAY
CasperSecurity


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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/private_html/utils/fix_completed_tracks.php
<?php
require_once 'config/database.php';

$pdo = getDBConnection();

echo "<h2>Fixing Completed Tracks</h2>";

// Check the task_results directory for completed tracks
$task_results_dir = 'task_results';
if (is_dir($task_results_dir)) {
    $result_files = glob("$task_results_dir/*.json");
    
    echo "<h3>Found " . count($result_files) . " result files</h3>";
    
    foreach ($result_files as $result_file) {
        $task_id = basename($result_file, '.json');
        $result_data = json_decode(file_get_contents($result_file), true);
        
        if ($result_data && isset($result_data['data']['callbackType']) && $result_data['data']['callbackType'] === 'complete') {
            echo "<p>Processing completed task: $task_id</p>";
            
            // Get the first audio URL
            $audio_data = $result_data['data']['data'][0] ?? null;
            if ($audio_data && isset($audio_data['audio_url'])) {
                $audio_url = $audio_data['audio_url'];
                $duration = $audio_data['duration'] ?? 30;
                $title = $audio_data['title'] ?? 'Generated Track';
                
                // Find the track in database
                $stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE task_id = ?");
                $stmt->execute([$task_id]);
                $track = $stmt->fetch();
                
                if ($track) {
                    // Update the track to complete with audio URL
                    $stmt = $pdo->prepare("
                        UPDATE music_tracks 
                        SET status = 'complete', audio_url = ?, duration = ?, metadata = ? 
                        WHERE task_id = ?
                    ");
                    $stmt->execute([$audio_url, $duration, json_encode($result_data), $task_id]);
                    
                    echo "<p style='color: green;'>✅ Updated track " . $track['id'] . " to complete!</p>";
                    echo "<p>Title: $title</p>";
                    echo "<p>Audio URL: $audio_url</p>";
                    echo "<p>Duration: $duration seconds</p>";
                } else {
                    echo "<p style='color: orange;'>⚠️ Track not found in database for task: $task_id</p>";
                }
            }
        }
    }
} else {
    echo "<p style='color: red;'>❌ task_results directory not found</p>";
}

// Also check for any tracks that are still "processing" but should be complete
echo "<h3>Checking Processing Tracks</h3>";

$stmt = $pdo->query("
    SELECT * FROM music_tracks 
    WHERE status = 'processing' 
    ORDER BY created_at DESC
");

$processing_tracks = $stmt->fetchAll();

foreach ($processing_tracks as $track) {
    $task_id = $track['task_id'];
    $result_file = "task_results/{$task_id}.json";
    
    if (file_exists($result_file)) {
        $result_data = json_decode(file_get_contents($result_file), true);
        
        if ($result_data && isset($result_data['data']['callbackType']) && $result_data['data']['callbackType'] === 'complete') {
            $audio_data = $result_data['data']['data'][0] ?? null;
            if ($audio_data && isset($audio_data['audio_url'])) {
                $audio_url = $audio_data['audio_url'];
                $duration = $audio_data['duration'] ?? 30;
                
                // Update the track
                $stmt = $pdo->prepare("
                    UPDATE music_tracks 
                    SET status = 'complete', audio_url = ?, duration = ?, metadata = ? 
                    WHERE id = ?
                ");
                $stmt->execute([$audio_url, $duration, json_encode($result_data), $track['id']]);
                
                echo "<p style='color: green;'>✅ Fixed processing track " . $track['id'] . " to complete!</p>";
                echo "<p>Audio URL: $audio_url</p>";
            }
        }
    }
}

echo "<h3>✅ Fix Complete!</h3>";
echo "<p>All completed tracks have been updated with their audio URLs.</p>";
echo "<p>You should now be able to play the music on your site!</p>";
?> 

CasperSecurity Mini