cms.event-export-inscription.php 987 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. error_reporting(E_ALL);
  3. ini_set("display_errors", 1);
  4. if (core::ifGet("from") AND core::getGet("from") == "event-export-inscription") {
  5. $row = event::getInscription(core::getGet("id"));
  6. $tmpList = 'inscripts-evenement-' . core::getGet("id") . '.csv';
  7. $csv = fopen(DIR_TEMP . $tmpList , 'w');
  8. fputcsv($csv, array(
  9. "id",
  10. "loginId",
  11. "idLocal",
  12. "jourEntree",
  13. "nom",
  14. "prenom",
  15. "sexe",
  16. "contrat",
  17. "lieu",
  18. "actif",
  19. "id_evenement",
  20. "present"),
  21. ";");
  22. foreach ($row as $fields) {
  23. fputcsv($csv, $fields, ";");
  24. }
  25. fclose($csv);
  26. header('Content-type: application/octet-stream;');
  27. header('Content-Transfer-Encoding: base64');
  28. header('Content-Disposition: attachment; filename="'.$tmpList.'"');
  29. readfile(DIR_TEMP . $tmpList);
  30. unlink(DIR_TEMP.$tmpList);
  31. } else {
  32. header('HTTP/1.0 401 Unauthorized');
  33. exit();
  34. }