First version, for githup; UNSTABLE, DO NOT USE!
This commit is contained in:
28
www/intern/scripts/ajax-create-ws-token.php
Normal file
28
www/intern/scripts/ajax-create-ws-token.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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]);
|
||||
Reference in New Issue
Block a user