From d101bab147552597442ed47201ba6060a8b096ef Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Mon, 20 May 2024 20:40:52 +0200 Subject: [PATCH] joined user and user_info tables in user_info.php --- res/forum/api/user_info.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/res/forum/api/user_info.php b/res/forum/api/user_info.php index 0e70239..501389c 100644 --- a/res/forum/api/user_info.php +++ b/res/forum/api/user_info.php @@ -17,10 +17,19 @@ if ($out -> num_rows != 1) if (!isset($_GET["username"])) return; -$out = $database -> query("SELECT username, admin FROM user WHERE username=\"" . $_GET["username"] . "\""); +$out = $database -> query("SELECT user.username, user.admin, user_info.bio, user_info.nickname, user_info.sex FROM user INNER JOIN user_info ON user.user_info=user_info.id AND username=\"" . $_GET["username"] . "\""); + +$sex = array(); +$sex[0] = "Nespecifikováno"; +$sex[1] = "Muž"; +$sex[2] = "Žena"; +$sex[9] = "Jiné"; while ($res = $out -> fetch_assoc()) { echo "Uživatelské jméno: " . $res["username"] . "
"; - echo "Admin: " . ($res["admin"] == 1 ? "Ano" : "Ne"); + echo "Přezdívka: " . $res["nickname"] . "
"; + echo "Admin: " . ($res["admin"] == 1 ? "Ano" : "Ne") . "
"; + echo "Pohlaví: " . $sex[$res["sex"]] . "
"; + echo "Bio: " . $res["bio"]; } \ No newline at end of file