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/live/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/public_html/radio/api/live/now_playing.php
<?php
/**
 * Get current now playing track
 */

header('Content-Type: application/json');
require_once __DIR__ . '/../../../config/database.php';

$pdo = getDBConnection();

$stream_id = isset($_GET['stream_id']) ? (int)$_GET['stream_id'] : 0;

if (!$stream_id) {
    http_response_code(400);
    echo json_encode(['error' => 'Missing stream_id']);
    exit;
}

// Get current track
$stmt = $pdo->prepare("
    SELECT np.*, mt.title, mt.audio_url, mt.image_url, mt.duration,
           u.name as artist_name, u.id as artist_id
    FROM radio_now_playing np
    JOIN music_tracks mt ON np.track_id = mt.id
    LEFT JOIN users u ON mt.user_id = u.id
    WHERE np.stream_id = ? AND np.ended_at IS NULL
    ORDER BY np.started_at DESC
    LIMIT 1
");
$stmt->execute([$stream_id]);
$now_playing = $stmt->fetch();

if (!$now_playing) {
    echo json_encode(['now_playing' => null]);
    exit;
}

// Calculate progress
$started = new DateTime($now_playing['started_at']);
$now = new DateTime();
$elapsed = $now->getTimestamp() - $started->getTimestamp();
$progress = min(100, ($elapsed / $now_playing['duration']) * 100);

echo json_encode([
    'now_playing' => [
        'track_id' => $now_playing['track_id'],
        'title' => $now_playing['title'],
        'artist' => $now_playing['artist_name'],
        'artist_id' => $now_playing['artist_id'],
        'audio_url' => $now_playing['audio_url'],
        'image_url' => $now_playing['image_url'],
        'duration' => $now_playing['duration'],
        'started_at' => $now_playing['started_at'],
        'elapsed' => $elapsed,
        'progress' => round($progress, 2)
    ]
]);


CasperSecurity Mini