whoami7 - Manager
:
/
home
/
bleuhbh
/
www
/
root
/
public
/
newRadio
/
Upload File:
files >> /home/bleuhbh/www/root/public/newRadio/webradio.php
<?php set_time_limit(0); // Permet l'exécution continue $musicDir = "../../../Musique Louis"; $ffmpegPath = '../../admin/php/ffmpeg/bin/ffmpeg'; $logFile = "./" . date('Y_m_d_H_i_s_') . "streamNewStar.log"; $userAgent = $_SERVER['HTTP_USER_AGENT']; function logMessage($message) { global $logFile, $userAgent; $timestamp = date('Y-m-d H:i:s'); file_put_contents($logFile, "[$timestamp] $userAgent $message\n", FILE_APPEND); } // Récupère tous les fichiers audio $files = scandir($musicDir); $audioFiles = array_values(array_filter($files, function($file) { return preg_match('/\.(mp3|wav|flac)$/i', $file); })); if (empty($audioFiles)) { http_response_code(500); echo "Aucun fichier audio trouvé."; exit; } // En-têtes HTTP pour le streaming header('Content-Type: audio/mpeg'); header('Cache-Control: no-cache'); header('Pragma: no-cache'); header('Expires: 0'); // Boucle infinie de streaming while (true) { $randomFile = $musicDir . '/' . $audioFiles[array_rand($audioFiles)]; logMessage("Streaming: " . basename($randomFile)); // Conversion et diffusion du fichier audio $command = sprintf( '%s -i %s -f mp3 -', escapeshellcmd($ffmpegPath), escapeshellarg($randomFile) ); $descriptorspec = [ 1 => ['pipe', 'w'], // stdout 2 => ['pipe', 'w'] // stderr ]; $process = proc_open($command, $descriptorspec, $pipes); if (is_resource($process)) { while (!feof($pipes[1])) { echo fread($pipes[1], 4096); flush(); } fclose($pipes[1]); fclose($pipes[2]); proc_close($process); } } ?>
Copyright ©2021 || Defacer Indonesia