created api for checking if user is admin

This commit is contained in:
Václav Šmejkal 2024-05-22 21:09:41 +02:00
parent 4a46719b46
commit d5c1e3c13f
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -0,0 +1,10 @@
<?php
include("../../global.php");
session_start();
header('Content-type: application/json');
if (!isset($_SESSION["username"])) return;
echo json_encode(["admin" => ($database -> query("SELECT username, admin FROM user WHERE username=\"" . $_SESSION["username"] . "\" AND admin=1")) -> num_rows == 1]);