45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* MSIN-3487 — PNG QR résultats événement (logo MS1).
|
|
* Endpoint léger (sans inc_manager) pour téléchargement direct.
|
|
*
|
|
* Affichage / DL : eve_resultats_qr.php?eve_id=760[&dl=1]
|
|
*/
|
|
session_start();
|
|
|
|
if (empty($_SESSION['usa_id'])) {
|
|
http_response_code(403);
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
echo 'Accès refusé.';
|
|
exit;
|
|
}
|
|
|
|
// Settings publics pour $vDomaine uniquement (pas tout le stack superadm).
|
|
require_once dirname(__FILE__) . '/../php/inc_settings.php';
|
|
require_once dirname(__FILE__) . '/../php/inc_fx_eve_extra.php';
|
|
|
|
$intEveId = isset($_GET['eve_id']) ? intval($_GET['eve_id']) : 0;
|
|
$blnDownload = !empty($_GET['dl']);
|
|
|
|
$binPng = fxKcEveResultatsQrPngBinary($intEveId, null, 10, true);
|
|
if ($binPng === false) {
|
|
http_response_code(400);
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
echo 'QR impossible à générer.';
|
|
exit;
|
|
}
|
|
|
|
$strFilename = 'qr_resultats_eve_' . $intEveId . '.png';
|
|
|
|
header('Content-Type: image/png');
|
|
header('Content-Length: ' . strlen($binPng));
|
|
header('Cache-Control: private, max-age=60');
|
|
if ($blnDownload) {
|
|
header('Content-Disposition: attachment; filename="' . $strFilename . '"');
|
|
} else {
|
|
header('Content-Disposition: inline; filename="' . $strFilename . '"');
|
|
}
|
|
|
|
echo $binPng;
|
|
exit;
|