created api for user_info
This commit is contained in:
parent
3abff922e1
commit
b48cd0c5a6
26
res/forum/api/user_info.php
Normal file
26
res/forum/api/user_info.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
include("../../global.php");
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION["username"])) goto fail;
|
||||
|
||||
$out = $database -> query("SELECT username, admin FROM user WHERE username=\"" . $_SESSION["username"] . "\" AND admin=\"1\"");
|
||||
|
||||
if ($out -> num_rows != 1)
|
||||
{
|
||||
fail:
|
||||
echo "nope";
|
||||
header("Location: ../../../index.php");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($_GET["username"])) return;
|
||||
|
||||
$out = $database -> query("SELECT username, admin FROM user WHERE username=\"" . $_GET["username"] . "\"");
|
||||
|
||||
while ($res = $out -> fetch_assoc())
|
||||
{
|
||||
echo "Uživatelské jméno: " . $res["username"] . "<br>";
|
||||
echo "Admin: " . ($res["admin"] == 1 ? "Ano" : "Ne");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user