permission($radice) && ! empty($_GET["token"])) { session_write_close(); if(! empty($_SESSION["ARCHIVIO-DOCUMENTALE"][$_GET["token"]])) { $result = $pdo->go($_SESSION["ARCHIVIO-DOCUMENTALE"][$_GET["token"]]["sql"], $_SESSION["ARCHIVIO-DOCUMENTALE"][$_GET["token"]]["bind"]); if($result->rowCount() > 0) { ini_set("max_execution_time", "600"); ini_set("memory_limit", "1024M"); $path = "{$config["chunk_folder"]}/{$_GET["token"]}.zip"; $zip = new ZipArchive; if ($zip->open("{$path}", ZipArchive::CREATE) === TRUE) { while ($record = $result->fetch(PDO::FETCH_ASSOC)) { $file = filesManager::getFilePathFromAttachmentRecord($record); if(file_exists($file)) { $zip->addFile($file, "{$record["codice"]}-{$record["name"]}"); } } $zip->close(); header('Content-Type: application/zip'); header('Content-Length: ' . filesize($path)); header('Content-Disposition: attachment; filename="export-archivio-documentale.zip"'); readfile($path); unlink($path); exit; } } } } exit; header('HTTP/1.0 403 Forbidden'); die(); ?>