<?php

	error_reporting(-1);  // Have PHP complain about absolutely everything.
	$conf['error_level'] = 2;  // Show all messages on your screen
	ini_set('display_errors', TRUE);  // These lines give you content on WSOD pages.
	ini_set('display_startup_errors', TRUE);
	
	ini_set('memory_limit', '512M');  

    $room = $_GET['room'];
    $lang = $_GET['lang'];
    $hour = $_GET['hour'];
    $day = $_GET['day'];

    if (strlen($hour) <= 2) {
        $h_d = "h-d";
    } else {
        $h_d = "-d";
    }

    $url = "s" . $room . "l" . $lang . "-" . $hour . $h_d . $day . ".mp4";

    header ("Content-type: octet/stream");
    header ("Content-disposition: attachment; filename=" . $url);
    header("Content-Length: " . filesize($url));
    ob_clean();
    readfile($url);
?>
