Sample text

This commit is contained in:
2023-08-19 21:15:47 +03:00
parent 611e213592
commit d4b7a03802
8 changed files with 126 additions and 17 deletions

View File

@@ -1,12 +1,23 @@
<?php
<?php // Viewing account data
require_once("../_auth.php");
require_once("../_json.php");
require_once("../_utils.php");
// Check if user with supplied login exists
function User_LoginExist ($login): bool {
global $db;
$s = $db->prepare("SELECT * FROM users WHERE login = ?");
$s->bind_param("s", $login);
$s->execute();
return (bool)$s->get_result()->fetch_assoc();
}
// Check if user has specified role
function User_HasRole ($id, $role) {
function User_HasRole ($id, $role): bool {
global $db;
$s = $db->prepare("SELECT * FROM users WHERE id = ?");
@@ -72,6 +83,8 @@ function User_GetInfoByID ($id) {
if (ThisFileIsRequested(__FILE__)) {
require_once("../_json.php");
$UserID = null;
if (isset($_REQUEST["id"])) {