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/public_html/radio/api/v1/endpoints/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/public_html/radio/api/v1/endpoints/catalog_tracks.php
<?php
/**
 * Get catalog tracks
 * GET /api/radio/v1/catalog/tracks
 */

// Include audio token system for signed URLs
require_once __DIR__ . '/../../../../utils/audio_token.php';

$pdo = getDBConnection();

// Get query parameters
$page = max(1, (int)($_GET['page'] ?? 1));
$limit = min(100, max(1, (int)($_GET['limit'] ?? 50)));
$offset = ($page - 1) * $limit;

$search = $_GET['search'] ?? '';
$genre = $_GET['genre'] ?? '';
$bpm_min = $_GET['bpm_min'] ?? null;
$bpm_max = $_GET['bpm_max'] ?? null;

// Build query
$where = ['radio_enabled = 1', 'status = "complete"'];
$params = [];

if ($search) {
    $where[] = '(title LIKE ? OR artist_name LIKE ?)';
    $search_term = '%' . $search . '%';
    $params[] = $search_term;
    $params[] = $search_term;
}

if ($genre) {
    $where[] = 'genre = ?';
    $params[] = $genre;
}

if ($bpm_min !== null) {
    $where[] = 'bpm >= ?';
    $params[] = (int)$bpm_min;
}

if ($bpm_max !== null) {
    $where[] = 'bpm <= ?';
    $params[] = (int)$bpm_max;
}

$where_sql = implode(' AND ', $where);

// Get total count
$count_stmt = $pdo->prepare("SELECT COUNT(*) FROM music_tracks WHERE $where_sql");
$count_stmt->execute($params);
$total = $count_stmt->fetchColumn();

// Get tracks
$sql = "SELECT 
    id, title, artist_name, genre, bpm, duration, 
    audio_url, radio_play_count, radio_last_played
    FROM music_tracks 
    WHERE $where_sql
    ORDER BY created_at DESC
    LIMIT ? OFFSET ?";

$stmt = $pdo->prepare($sql);
$params[] = $limit;
$params[] = $offset;
$stmt->execute($params);
$tracks = $stmt->fetchAll(PDO::FETCH_ASSOC);

// Replace raw audio URLs with signed URLs (24-hour expiration for radio stations)
$radioTokenExpiry = 86400; // 24 hours in seconds
foreach ($tracks as &$track) {
    if (!empty($track['audio_url'])) {
        // Generate signed URL with 24-hour expiration
        $track['audio_url'] = getSignedAudioUrl($track['id'], null, $radioTokenExpiry);
        $track['audio_url_expires_in'] = $radioTokenExpiry;
    }
}
unset($track);

echo json_encode([
    'tracks' => $tracks,
    'pagination' => [
        'page' => $page,
        'limit' => $limit,
        'total' => $total,
        'pages' => ceil($total / $limit)
    ]
]);


CasperSecurity Mini