2024-05-21 17:49:42 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include("../../global.php");
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
if (!isset($_SESSION["username"])) goto fail;
|
|
|
|
|
2024-05-22 16:01:41 +02:00
|
|
|
$out = $database -> query("SELECT username, admin FROM user WHERE BINARY username=\"" . $_SESSION["username"] . "\" AND admin=\"1\"");
|
2024-05-21 17:49:42 +02:00
|
|
|
|
|
|
|
if ($out -> num_rows != 1)
|
|
|
|
{
|
|
|
|
fail:
|
|
|
|
echo "nope";
|
|
|
|
header("Location: ../../../index.php");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($_GET["username"])) return;
|
|
|
|
|
2024-05-25 15:49:49 +02:00
|
|
|
$safe_username = mysqli_real_escape_string($database, $_GET["username"]);
|
|
|
|
|
|
|
|
$user_info_id = (($database -> query("SELECT user_info FROM user WHERE BINARY username=\"" . $safe_username . "\"")) -> fetch_assoc())["user_info"];
|
2024-05-21 17:49:42 +02:00
|
|
|
|
|
|
|
$database -> query("DELETE FROM user WHERE user_info=" . $user_info_id);
|
|
|
|
$database -> query("DELETE FROM user_info WHERE id=" . $user_info_id);
|