public static sanitize_filename ( $filename ) |
public static function sanitize_filename($filename)
{
$nonprinting = array_map('chr', range(0, 31));
$invalid_chars = array('<', '>', '?', '"', ':', '|', '\\', '/', '*', '&');
$all_invalids = array_merge($nonprinting, $invalid_chars);
return str_replace($all_invalids, "", $filename);
}
//hub $row[]=$hub; //date created $row[]=$region; //append $xls->addRow($row); } //output to browser $xls->sendFile(); } break; case "multipleresultsexcel": //filename of the excel file to be downloaded $filename=0; $filename="excel.patientsmultipleresults.".getFormattedDateCRB($datetime).".xlsx"; header('Content-disposition: attachment; filename="'.XLSXWriter::sanitize_filename($filename).'"'); header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); header('Content-Transfer-Encoding: binary'); header('Cache-Control: must-revalidate'); header('Pragma: public'); //abbottResults $query=0; $query=mysqlquery("select patientID,facilityID,count(vlSampleID) num from vl_samples where vlSampleID in (select sampleID from vl_results_abbott) group by patientID having num>1 order by num desc"); //header $headerAbbottResults = array( 'Patient ART'=>'string', 'Patient Other ID'=>'string', 'Facility'=>'string', 'Number of Results'=>'string', 'Results'=>'string');