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/user_tracks.php
<?php
// View all tracks for a specific user
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once 'config/database.php';

$user_id = $_GET['user_id'] ?? null;

if (!$user_id) {
    echo "<h1>❌ Error: No user ID provided</h1>";
    echo "<p>Usage: /user_tracks.php?user_id=USER_ID</p>";
    exit;
}

$pdo = getDBConnection();
if (!$pdo) {
    echo "<p style='color: red;'>❌ Database connection failed</p>";
    exit;
}

// Get user info
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();

if (!$user) {
    echo "<p style='color: red;'>❌ User not found</p>";
    exit;
}

// Get user's tracks
$stmt = $pdo->prepare("
    SELECT * FROM music_tracks 
    WHERE user_id = ? 
    ORDER BY created_at DESC
");
$stmt->execute([$user_id]);
$tracks = $stmt->fetchAll();

echo "<h1>👤 User Tracks: {$user['name']}</h1>";
echo "<p><strong>Email:</strong> {$user['email']}</p>";
echo "<p><strong>Credits:</strong> {$user['credits']}</p>";
echo "<p><strong>Plan:</strong> {$user['plan']}</p>";

// Summary statistics
$total_tracks = count($tracks);
$completed_tracks = count(array_filter($tracks, fn($t) => $t['status'] === 'complete'));
$processing_tracks = count(array_filter($tracks, fn($t) => $t['status'] === 'processing'));
$failed_tracks = count(array_filter($tracks, fn($t) => $t['status'] === 'failed'));

echo "<h2>📊 User Statistics</h2>";
echo "<div style='display: flex; gap: 20px; margin: 20px 0;'>";
echo "<div style='background: #48bb78; color: white; padding: 20px; border-radius: 10px; text-align: center;'>";
echo "<h3>Total Tracks</h3><p style='font-size: 2rem;'>$total_tracks</p>";
echo "</div>";
echo "<div style='background: #48bb78; color: white; padding: 20px; border-radius: 10px; text-align: center;'>";
echo "<h3>Completed</h3><p style='font-size: 2rem;'>$completed_tracks</p>";
echo "</div>";
echo "<div style='background: #ed8936; color: white; padding: 20px; border-radius: 10px; text-align: center;'>";
echo "<h3>Processing</h3><p style='font-size: 2rem;'>$processing_tracks</p>";
echo "</div>";
echo "<div style='background: #e53e3e; color: white; padding: 20px; border-radius: 10px; text-align: center;'>";
echo "<h3>Failed</h3><p style='font-size: 2rem;'>$failed_tracks</p>";
echo "</div>";
echo "</div>";

if ($tracks) {
    echo "<h2>🎵 User's Tracks</h2>";
    echo "<table border='1' style='border-collapse: collapse; margin: 20px 0; width: 100%;'>";
    echo "<tr style='background: #f0f0f0;'>";
    echo "<th>ID</th><th>Task ID</th><th>Title</th><th>Status</th><th>Audio URL</th><th>Created</th><th>Updated</th><th>Actions</th>";
    echo "</tr>";
    
    foreach ($tracks as $track) {
        $status_color = $track['status'] === 'complete' ? 'green' : ($track['status'] === 'failed' ? 'red' : 'orange');
        $audio_url = $track['audio_url'] ? '✅ Has URL' : '❌ No URL';
        
        echo "<tr>";
        echo "<td>{$track['id']}</td>";
        echo "<td style='font-family: monospace; font-size: 10px;'>{$track['task_id']}</td>";
        echo "<td>{$track['title']}</td>";
        echo "<td style='color: $status_color;'>{$track['status']}</td>";
        echo "<td>$audio_url</td>";
        echo "<td>{$track['created_at']}</td>";
        echo "<td>{$track['updated_at']}</td>";
        echo "<td>";
        echo "<a href='/check_track_status.php?track_id={$track['id']}' style='color: #667eea; margin-right: 10px;'>🔍 Check</a>";
        if ($track['status'] === 'processing') {
            echo "<button onclick='checkApiBox(\"{$track['task_id']}\")' style='background: #667eea; color: white; border: none; padding: 3px 6px; border-radius: 3px; cursor: pointer;'>🌐 API.Box</button>";
        }
        if ($track['audio_url']) {
            echo "<a href='{$track['audio_url']}' target='_blank' style='color: #48bb78; margin-left: 10px;'>🎵 Play</a>";
        }
        echo "</td>";
        echo "</tr>";
    }
    echo "</table>";
} else {
    echo "<p>No tracks found for this user.</p>";
}

// API.Box verification
echo "<h2>🌐 API.Box Verification</h2>";
echo "<p>Checking API.Box for this user's tracks...</p>";

$api_key = '63edba40620216c5aa2c04240ac41dbd';
$api_url = 'https://api.api.box/api/v1/tasks';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $api_key,
    'Content-Type: application/json',
    'User-Agent: SoundStudioPro-User/1.0'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code === 200) {
    $api_logs = json_decode($response, true);
    
    if (isset($api_logs['data']) && is_array($api_logs['data'])) {
        $user_task_ids = array_column($tracks, 'task_id');
        $user_api_tracks = [];
        
        foreach ($api_logs['data'] as $log_entry) {
            if (isset($log_entry['taskId']) && in_array($log_entry['taskId'], $user_task_ids)) {
                $user_api_tracks[] = $log_entry;
            }
        }
        
        if ($user_api_tracks) {
            echo "<h3>✅ Found {$user['name']}'s tracks in API.Box</h3>";
            echo "<table border='1' style='border-collapse: collapse; margin: 20px 0; width: 100%;'>";
            echo "<tr style='background: #f0f0f0;'>";
            echo "<th>Task ID</th><th>Type</th><th>Status</th><th>Created</th><th>Actions</th>";
            echo "</tr>";
            
            foreach ($user_api_tracks as $api_track) {
                $status_color = $api_track['status'] === 'success' ? 'green' : 'orange';
                
                echo "<tr>";
                echo "<td style='font-family: monospace;'>{$api_track['taskId']}</td>";
                echo "<td>{$api_track['type']}</td>";
                echo "<td style='color: $status_color;'>{$api_track['status']}</td>";
                echo "<td>" . (isset($api_track['createdAt']) ? $api_track['createdAt'] : 'Unknown') . "</td>";
                echo "<td>";
                echo "<button onclick='checkApiBoxStatus(\"{$api_track['taskId']}\")' style='background: #667eea; color: white; border: none; padding: 3px 6px; border-radius: 3px; cursor: pointer;'>🔍 Check</button>";
                echo "</td>";
                echo "</tr>";
            }
            echo "</table>";
        } else {
            echo "<p style='color: orange;'>⚠️ No tracks found in API.Box for this user</p>";
        }
    }
} else {
    echo "<p style='color: red;'>❌ Failed to fetch API.Box logs (HTTP $http_code)</p>";
}

echo "<h3>🔗 Quick Links</h3>";
echo "<p><a href='/sync_api_box_tracks.php' style='color: #667eea;'>🔄 Sync All Tracks</a> | ";
echo "<a href='/debug_tracks.php' style='color: #667eea;'>🔍 Debug Tracks</a> | ";
echo "<a href='/library.php' style='color: #667eea;'>📚 View Library</a></p>";
?>

<script>
async function checkApiBox(taskId) {
    const apiKey = '<?php echo $api_key; ?>';
    const apiUrl = `https://api.api.box/api/v1/status/${taskId}`;
    
    try {
        const response = await fetch(apiUrl, {
            headers: {
                'Authorization': `Bearer ${apiKey}`,
                'Content-Type': 'application/json'
            }
        });
        
        const data = await response.json();
        
        alert(`API.Box Status for ${taskId}:\n\n${JSON.stringify(data, null, 2)}`);
    } catch (error) {
        alert('Error checking API.Box: ' + error.message);
    }
}

async function checkApiBoxStatus(taskId) {
    const apiKey = '<?php echo $api_key; ?>';
    const apiUrl = `https://api.api.box/api/v1/status/${taskId}`;
    
    try {
        const response = await fetch(apiUrl, {
            headers: {
                'Authorization': `Bearer ${apiKey}`,
                'Content-Type': 'application/json'
            }
        });
        
        const data = await response.json();
        
        alert(`API.Box Status for ${taskId}:\n\n${JSON.stringify(data, null, 2)}`);
    } catch (error) {
        alert('Error checking API.Box status: ' + error.message);
    }
}
</script> 

CasperSecurity Mini