gerarchia <= 10 && $_SESSION["utente"]->fromHere() && !empty($_GET["type"])) { $type = ""; $mime = ""; if ($_GET["type"] === "zip") { $type = "zip"; $mime = "application/zip"; } if ($_GET["type"] === "json") { $type = "json"; $mime = "plain/text"; } if (!empty($type)) { $filePath = "{$config["mediaFolder"]}/{$_SESSION["ente"]->codice}/export/data.{$type}"; if (file_exists($filePath)) { ini_set('max_execution_time', 0); ini_set('memory_limit', '-1'); header("Content-Type: {$mime}"); header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename=data.'.$type); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); $chunk = 1024 * 1024; $handle = fopen($filePath, 'rb'); while (!feof($handle)) { $buffer = fread($handle, $chunk); echo $buffer; ob_flush(); flush(); } fclose($handle); die(); } } } header('HTTP/1.0 403 Forbidden'); die(); ?>