09-29-2017, 12:59 AM
(This post was last modified: 09-29-2017, 01:55 AM by wolfgang1983.)
When I download my PHP Excel file my internet security says this is a dangerous file but it is not.
Question is there any where in the code below that might be causing this warning from my McAfee security? How to stop it so does not detect it as a dangerous file.
![[Image: 3c2Yrdmw6wlG.png]](https://ibin.co/3c2Yrdmw6wlG.png)
Thank you for your time.
Question is there any where in the code below that might be causing this warning from my McAfee security? How to stop it so does not detect it as a dangerous file.
![[Image: 3c2Yrdmw6wlG.png]](https://ibin.co/3c2Yrdmw6wlG.png)
Thank you for your time.
PHP Code:
<?php
class Events extends MX_Controller {
public function generate_excel() {
$query = $this->db->get('event');
$excelresults = $query->result_array();
require (APPPATH . 'third_party/PHPExcel-1.8/Classes/PHPExcel.php');
require (APPPATH . 'third_party/PHPExcel-1.8/Classes/PHPExcel/Writer/Excel2007.php');
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("");
$objPHPExcel->getProperties()->setLastModifiedBy("");
$objPHPExcel->getProperties()->setSubject("");
$objPHPExcel->getProperties()->setCreator("");
$objPHPExcel->getProperties()->setDescription("");
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->SetCellValue("A1", 'Event');
$objPHPExcel->getActiveSheet()->SetCellValue("B1", 'Event Title');
$objPHPExcel->getActiveSheet()->SetCellValue("C1", 'Event Date');
$objPHPExcel->getActiveSheet()->SetCellValue("D1", 'Event Start Time');
foreach (range('A', $objPHPExcel->getActiveSheet()->getHighestDataColumn()) as $col) {
$objPHPExcel->getActiveSheet()
->getColumnDimension($col)
->setAutoSize(true);
}
$excelrow = 2;
foreach ($excelresults as $excelresult => $excelvalue) {
$objPHPExcel->getActiveSheet()->SetCellValue("A" . $excelrow, $excelvalue['event']);
$objPHPExcel->getActiveSheet()->SetCellValue("B" . $excelrow, $excelvalue['event_title']);
$objPHPExcel->getActiveSheet()->SetCellValue("C" . $excelrow, $excelvalue['event_date']);
$objPHPExcel->getActiveSheet()->SetCellValue("D" . $excelrow, $excelvalue['event_start_time']);
$excelrow++;
}
$filename = 'Bowling-Events-For-' . date('Y') . '.xlsx';
$objPHPExcel->getProperties()->setTitle("Riwaka Bowling Club Events");
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$filename.'"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
}
}
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!