query("SELECT username, admin FROM user WHERE BINARY 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"); $output = array(); while ($res = $out -> fetch_assoc()) { array_push($output, $res["username"]); } header('Content-type: application/json'); echo json_encode(["users" => $output]);