Проект ещё жив!
This commit is contained in:
@@ -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()) {
|
||||
|
Reference in New Issue
Block a user