28 lines
713 B
PHP
28 lines
713 B
PHP
<?php
|
|
|
|
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
|
|
|
if (
|
|
!((isset($_SESSION['access_granted_wk_leitung']) && $_SESSION['access_granted_wk_leitung'] === true) ||
|
|
(isset($_SESSION['access_granted_kampfrichter']) && $_SESSION['access_granted_kampfrichter'] === true))
|
|
) {
|
|
http_response_code(403);
|
|
exit;
|
|
}
|
|
|
|
if (!isset($_POST['access'])) {
|
|
http_response_code(400);
|
|
exit;
|
|
}
|
|
|
|
$access = preg_replace("/[\W]/", "", trim($_POST['access']));
|
|
|
|
$baseDir = $_SERVER['DOCUMENT_ROOT'];
|
|
|
|
require $baseDir . "/../scripts/websocket/ws-create-token.php";
|
|
|
|
$token = generateWSToken($access);
|
|
|
|
$responseBool = $token != null;
|
|
|
|
echo json_encode(['success' => $responseBool, 'token' => $token]); |