<?php
/**
 * public/acceso/download_installer.php
 * Descargador seguro y directo del Paquete de Instalación Local (.zip) para Cyfort Access Pro.
 */
declare(strict_types=1);

ob_clean();

$zipFile = __DIR__ . '/../downloads/Cyfort_Access_Pro_Local_Installer.zip';

if (!file_exists($zipFile)) {
    http_response_code(404);
    echo "⚠️ Paquete de instalación local no encontrado en el servidor.";
    exit;
}

$filename = 'Cyfort_Access_Pro_Local_Installer.zip';
$fileSize = filesize($zipFile);

if (!headers_sent()) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/zip');
    header('Content-Disposition: attachment; filename="' . $filename . '"');
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . $fileSize);
}

readfile($zipFile);
exit;
