noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 03/26: New function header_csv($filename)


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 03/26: New function header_csv($filename)
Date: Wed, 11 Aug 2021 11:08:08 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 6e935c9326198ce209407cb6bffba7b0d2e6858b
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue Jul 27 12:18:28 2021 +0200

    New function header_csv($filename)
---
 include/lib/ac_common.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index 3dd5261..64a7834 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1204,6 +1204,21 @@ function display_menu($p_menuid)
 
 }
 /**
+ * @brief Send an header CSV with a filename
+ * @param string $p_filename , file name , caution , it must be sanitized 
BEFORE calling this function
+ */
+function header_csv($p_filename)
+{
+  
+    header('Pragma: public');
+    header('Content-type: application/csv');
+    header("Content-Disposition: attachment;filename=\"{$p_filename}\"",
+            FALSE);
+    header('Cache-Control: no-store, no-cache, must-revalidate');
+    header('Expires: Sun, 1 Jan 2000 12:00:00 GMT');
+    header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT');
+}
+/**
  * Put in superglobal (get,post,request) the value contained in
  * the parameter field (me_parameter)
  * @param $array [key] [value]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]