Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2015, 19:09
xoceunder
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
duda en abrir archivo m3u8

Hola a todos es que ando tratando de poder esconder los archivos m3u8

ahora bien estoy usando nginx para poder localizar mi archivo

rewrite ^/(.*)/(.*)/(.*)$ /stream.php?username=$1&password=$2&stream=$3 break;

pero como quiera obtienen el link directo del archivo

mi archivo stream.php
Código PHP:
Ver original
  1. <?php
  2. include ("config.php");
  3. use Carbon\Carbon;
  4.  
  5. $ip = $_SERVER['REMOTE_ADDR'];
  6. $username=$_GET['username'];
  7. $password=$_GET['password'];
  8. $id=$_GET['stream'];
  9. $setting = Setting::first();
  10.  
  11. if (empty($_GET['username']) || empty($_GET['password'])) {
  12.     $error = "Username or Password is invalid";
  13.     header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
  14.     header('Status: 404 Not Found');
  15.     die();
  16. }
  17.  
  18. $user = User::where('username', '=', $username)->where('password', '=', $password)->where('active', '=', 1)->first();
  19.  
  20. if (!isset($_SESSION['user_id'])){ // TODO: secret key
  21.     $token = (!$user) ? die() : uniqid();
  22. }
  23.  
  24. if($user->exp_date != "0000-00-00") {
  25.     if($user->exp_date <=  Carbon::today()) {
  26.         die();
  27.     }
  28. }
  29.  
  30. $stream = Stream::find($id);
  31. if (!isset($_SESSION['user_id'])) { // TODO: secret key
  32.     (!$stream ? die() : "");
  33. }
  34.  
  35. ($stream->status != 1 ? die() : "");
  36.  
  37.  
  38.  
  39. $user->lastconnected_ip = $ip;
  40. $user->last_stream = $stream->id;
  41. $user->useragent = $_SERVER['HTTP_USER_AGENT'];
  42. $user->save();
  43.  
  44.  
  45. $url =  $stream->streamurl;
  46.  
  47. $file = "http://".$setting->webip.":".$setting->webport."/".$setting->hlsfolder."/".$id."_.m3u8";
  48.  
  49. if($setting->less_secure) {
  50.     header("location: $file");
  51.     die();
  52. }
  53.  
  54. $streamo = (($stream->restream == true) ? $url :  $file);
  55.  
  56. $fd = fopen($streamo, "r");
  57. while(!feof($fd)) {
  58.     echo fread($fd, 1024 * 5);
  59.     ob_flush();
  60.     flush();
  61.     if (connection_aborted()){
  62.         break;
  63.     }
  64. }
  65. fclose ($fd);
  66. exit();
  67. die();