menu csv full operationnel
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/session.php';
|
||||
|
||||
if (empty($_SESSION['user_id'])) {
|
||||
header('Location: ../index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$csvFilePath = __DIR__ . '/../assets/csv/actions.csv';
|
||||
|
||||
if (!is_readable($csvFilePath)) {
|
||||
http_response_code(404);
|
||||
echo 'Fichier CSV introuvable.';
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-Type: text/csv; charset=UTF-8');
|
||||
header('Content-Disposition: attachment; filename="actions.csv"');
|
||||
header('Content-Length: ' . (string) filesize($csvFilePath));
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
readfile($csvFilePath);
|
||||
exit;
|
||||
Reference in New Issue
Block a user