File: //usr/src/installd-accountdnscheck/web/downloadreport.php
<?php
if(isset($_REQUEST['report'])) {
if(preg_match('/^[a-zA-Z0-9\-_\.]*$/', $_REQUEST['report'])) {
if(is_file('/var/cpanel/addons/accountdnscheck/reports/' . $_REQUEST['report'])) {
// CSV download
if(preg_match('/\.csv$/', $_REQUEST['report'])) {
header('Content-type: text/csv');
header("Pragma: public");
header("Expires: 0");
header('Cache-Control: must-revalidate');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=' . $_REQUEST['report']);
header('Content-Length: ' . filesize('/var/cpanel/addons/accountdnscheck/reports/' . $_REQUEST['report']));
ob_clean();
flush();
readfile('/var/cpanel/addons/accountdnscheck/reports/' . $_REQUEST['report']);
}
}
}
}