created php api for user removing
This commit is contained in:
parent
709a2ccc78
commit
2a3f639a66
23
res/forum/api/remove_user.php
Normal file
23
res/forum/api/remove_user.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?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;
|
||||
|
||||
$user_info_id = (($database -> query("SELECT user_info FROM user WHERE username=\"" . $_GET["username"] . "\"")) -> fetch_assoc())["user_info"];
|
||||
|
||||
$database -> query("DELETE FROM user WHERE user_info=" . $user_info_id);
|
||||
$database -> query("DELETE FROM user_info WHERE id=" . $user_info_id);
|
Loading…
x
Reference in New Issue
Block a user