FabrikaHradekTour/res/forum/api/list_users.php

24 lines
524 B
PHP

<?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;
}
$out = $database -> query("SELECT username FROM user ORDER BY id ASC");
while ($res = $out -> fetch_assoc())
{
echo "<div class=\"output\">" . $res["username"] . "</div>";
}