Files
ms1inscription-v5/ajax_inscr_gestion_qr.php

50 lines
1.4 KiB
PHP

<?php
session_start();
// MSIN-4401 — Traductions toujours au nom de compte.php (jamais ajax_inscr_gestion_qr.php).
define('MS1_INSCR_GESTION_AJAX', true);
$_SERVER['PHP_SELF'] = '/compte.php';
$_SERVER['SCRIPT_NAME'] = '/compte.php';
require_once 'php/inc_fonctions.php';
require_once 'php/inc_fx_inscriptions_gestion.php';
global $vDomaine;
$strLangue = 'fr';
if (!empty($_REQUEST['lang']) && in_array($_REQUEST['lang'], array('fr', 'en'), true)) {
$strLangue = $_REQUEST['lang'];
}
$vPage = 'compte.php';
$vtexte_page = obtenirTextepage($vPage, $strLangue, 2);
fxInscrGestionInitTextes($strLangue);
header('Content-Type: application/json; charset=utf-8');
if (!isset($_SESSION['com_id'])) {
// MSIN-4401 — session morte : pas un faux "QR invalide".
echo json_encode(array('state' => 'error', 'code' => 'session', 'message' => 'session'));
exit;
}
$intEveId = 0;
if (!empty($_REQUEST['promoteur_eve_id'])) {
$intEveId = fxInscrGestionParseEveId($_REQUEST['promoteur_eve_id']);
}
if ($intEveId <= 0 || !fxInscrGestionCanScan($_SESSION['com_id'], $intEveId)) {
echo json_encode(array('state' => 'error', 'message' => fxInscrGestionT('inscr_gestion_qr_invalid')));
exit;
}
$strRaw = '';
if (!empty($_REQUEST['qr'])) {
$strRaw = $_REQUEST['qr'];
} elseif (!empty($_REQUEST['t'])) {
$strRaw = $_REQUEST['t'];
}
echo json_encode(fxInscrGestionResolveQrScan($strRaw, $intEveId, $strLangue));