gestione gare pubbliche
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

43 righe
1.4 KiB

<?php
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
if (!empty($_SESSION["utente"]) && !empty($_SESSION["ente"]) && $_SESSION["utente"]->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();
?>