preventing user from setting admin to himself lol
This commit is contained in:
parent
67f704d19e
commit
4a46719b46
@ -9,15 +9,20 @@ $out = $database -> query("SELECT username, admin, user_info FROM user WHERE BIN
|
||||
|
||||
if (!isset($_GET["old_username"])) return;
|
||||
|
||||
$user = false;
|
||||
|
||||
if ($out -> num_rows != 1 && $_GET["old_username"] != $_SESSION["username"])
|
||||
{
|
||||
fail:
|
||||
echo "nope";
|
||||
header("Location: ../../../index.php");
|
||||
return;
|
||||
} else if ($out -> num_rows != 1)
|
||||
{
|
||||
$user = true;
|
||||
}
|
||||
|
||||
$user_info_id = (($database -> query("SELECT user_info FROM user WHERE username=\"" . $_GET["old_username"] . "\"")) -> fetch_assoc())["user_info"];
|
||||
|
||||
$database -> query("UPDATE user SET username=\"" . $_GET["username"] . "\", admin=" . $_GET["admin"] . " WHERE user_info=" . $user_info_id);
|
||||
if (!$user) $database -> query("UPDATE user SET username=\"" . $_GET["username"] . "\", admin=" . $_GET["admin"] . " WHERE user_info=" . $user_info_id);
|
||||
$database -> query("UPDATE user_info SET sex=" . $_GET["sex"] . ", bio=\"" . $_GET["bio"] . "\", nickname=\"" . $_GET["nickname"] . "\" WHERE id=" . $user_info_id);
|
Loading…
x
Reference in New Issue
Block a user