<?php
require_once __DIR__ . "/../php/server/session.php";
pialert_start_session();

if ($_SESSION["login"] != 1) {
	header('Location: ../index.php');
	exit;
}

$ARCHIVE_PATH = str_replace('download', '', str_replace('front', 'db', getcwd()));
$CSVFILE = $ARCHIVE_PATH . "pialertcsv.zip";

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($CSVFILE) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($CSVFILE));
readfile($CSVFILE);
exit;
?>
