Проект ещё жив!

This commit is contained in:
2023-12-20 06:08:13 +03:00
parent a573faf5a1
commit 8d74a51937
23 changed files with 358 additions and 143 deletions

View File

@@ -15,6 +15,8 @@ require_once("./index.php");
* Delete existing account
*/
function User_Delete (int $id): ReturnT {
global $db;
$s = $db->prepare("delete from users where id = ?");
$s->bind_param("s", $id);
@@ -30,7 +32,7 @@ function User_Delete (int $id): ReturnT {
* Delete existing account
*/
function User_Delete_Method (array $req): ReturnT {
global $db, $LOGGED_IN, $THIS_USER;
global $LOGGED_IN, $THIS_USER;
$id = null;
@@ -47,7 +49,7 @@ function User_Delete_Method (array $req): ReturnT {
}
// If its attempt to delete other account
if (!User_HasRole($THIS_USER, "admin").GetData() && $THIS_USER !== $id)
if (!User_HasRole($THIS_USER, "admin")->GetData() && $THIS_USER !== $id)
return new ReturnT(err_code: E_ACS_INSUFROLE, err_desc: "you must be admin to delete other accounts");
// Actions
@@ -63,7 +65,7 @@ if (Utils_ThisFileIsRequested(__FILE__)) {
// HACK: for debugging purposes. Will be removed later
if ($Config["debug"])
$_POST = $_REQUEST;
$result = User_Delete_Method($_POST);
if ($result->IsError()) {