<?php

    session_start();
    
    if ( ($_SESSION['auth'] != true) || (($_SESSION['authId'] != 1) && ($_SESSION['authId'] != 3)) )
    {
        $_SESSION['auth'] = false;
    	  header("Location: ../login.php");
    }

    $filename = $_GET['file'];
    $download = $_GET['download'];
   
    if($download == 0)
    {
      header("Content-Type: application/pdf");
      readfile("../sepa_listen/$filename");  
    }
    else
    {
      header("Content-Disposition: attachment; filename=" . Urlencode($filename));   
      header("Content-Type: application/octet-stream");
      readfile("../sepa_listen/$filename");  
    }

?>
