ComicsViewer/downloadcomic.php
2023-08-18 12:50:45 -04:00

24 lines
592 B
PHP

<?php
require 'header.php';
require_login();
if ( isset($_REQUEST['comic']) ) {
$comic = makePathSafe(base64_decode(urldecode(($_REQUEST['comic']))));
$comicfull = COMICSDIR . $comic;
} else {
exit();
}
header("Pragma: public");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . trim(basename($comicfull)) . "\"");
header("Content-Description: " . trim(basename($comicfull)));
header("Expires: 0");
header("Cache-Control: must-revalidate");
header("Content-length: " . filesize($comicfull));
readfile($comicfull);
exit();