* * Gedacht für ein Tablet oder einen Bildschirm im Empfangsbereich: ein großer * Knopf, ein Klick, ein Zugangscode. Gäste ohne Zugriff auf den Bildschirm * können denselben Link über den QR-Code am Handy öffnen. */ error_reporting(E_ALL); ini_set('display_errors', 0); ini_set('log_errors', 1); require_once __DIR__ . '/config.php'; require_once __DIR__ . '/includes/Database.php'; require_once __DIR__ . '/includes/Auth.php'; require_once __DIR__ . '/includes/I18n.php'; require_once __DIR__ . '/includes/Ui.php'; require_once __DIR__ . '/includes/Kiosk.php'; require_once __DIR__ . '/includes/VoucherService.php'; I18n::init(); try { $db = Database::getInstance(); $auth = new Auth(); } catch (Exception $e) { http_response_code(500); die('Datenbankfehler'); } $appTitle = $db->getSetting('app_title', 'UniFi Voucher System'); $token = Kiosk::sanitizeToken($_GET['k'] ?? ''); $kiosk = $token !== '' ? Kiosk::findByToken($db, $token) : null; if (!$kiosk) { http_response_code(404); $notFound = true; } else { $notFound = false; } $voucher = null; // erzeugter Code $error = ''; $waitSecs = 0; if (!$notFound && $_SERVER['REQUEST_METHOD'] === 'POST') { if (!$auth->validateCsrfToken($_POST['csrf_token'] ?? '')) { $error = __('error_csrf'); } else { $limits = Kiosk::checkLimits($db, $kiosk); if (!$limits['allowed']) { $waitSecs = (int)$limits['wait']; $error = $limits['reason'] === 'cooldown' ? str_replace('{seconds}', (string)$waitSecs, __('kiosk_error_cooldown')) : __('kiosk_error_limit'); } else { try { $site = $db->fetchOne("SELECT * FROM sites WHERE id = ? AND is_active = 1", [(int)$kiosk['site_id']]); if (!$site) { throw new Exception(__('error_site_not_found')); } $settings = Kiosk::voucherSettings($db, $kiosk); $voucher = VoucherService::create( $db, $site, $kiosk['name'], $settings['max_uses'], $settings['expire_minutes'], null, $settings['qos'], (int)$kiosk['id'] ); Kiosk::markUsed($db, (int)$kiosk['id']); $auth->writeAuditLog(null, 'voucher_kiosk', 'kiosk', (int)$kiosk['id'], $kiosk['name'] . ' · ' . $voucher['code']); } catch (Exception $e) { error_log('Kiosk-Fehler: ' . $e->getMessage()); $error = __('kiosk_error_generic'); } } } } $headline = trim((string)($kiosk['headline'] ?? '')) ?: __('kiosk_default_headline'); $subline = trim((string)($kiosk['subline'] ?? '')) ?: __('kiosk_default_subline'); $logoUrl = $db->getSetting('logo_url', ''); $display = max(10, (int)($kiosk['display_seconds'] ?? Kiosk::DEFAULT_DISPLAY_SECONDS)); $selfUrl = $kiosk ? Kiosk::publicUrl($kiosk['token']) : ''; ?> <?= htmlspecialchars($appTitle) ?>

' . $display . '', __('kiosk_reset_in')) ?>