
<?php

$files_all = array(
	'zas2.zip', 
	'zas2.htm', 
	'zas2-css.css', 
	'zas2-db.js', 
	'zas2-db-changes.js', 
	'zas2-inc.js', 
	'zas2-eng.js'
	);

$key  = 'file';
$file = isset($_GET[$key]) ? $_GET[$key] : '';
$file = in_array($file,$files_all) ? $file : '';

if ($file!=='' && file_exists($file)) {
	$file_path = '';
    ob_clean();
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="'.basename($file).'"');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file_path.$file));
    readfile($file_path.$file);
    exit;
}


/*
$zip_path = '';
$zip_name = 'zas2.zip';
    ob_clean();
    header('Content-Description: File Transfer');
    header('Content-type: application/zip'); 
    header('Content-Disposition: attachment; filename='.basename($zip_name));
    header('Pragma: no-cache'); 
    header('Expires: 0'); 
    header('Cache-Control: must-revalidate');
    header('Content-Length: ' . filesize($zip_path.$zip_name));
    readfile($zip_path.$zip_name);
    exit;
}
*/

?>
