fix admin

This commit is contained in:
themohooks 2024-07-21 17:53:09 +03:00
parent f5d26107b8
commit 87c7fa537b
2 changed files with 2 additions and 3 deletions

View file

@ -25,7 +25,7 @@ if (isset($_POST['subbtn'])) {
$updatedJson = updateJson($currentJson, 'premoderation', $premoderation); $updatedJson = updateJson($currentJson, 'premoderation', $premoderation);
$updatedJsonString = json_encode($updatedJson, JSON_PRETTY_PRINT); $updatedJsonString = json_encode($updatedJson, JSON_PRETTY_PRINT);
if ($admin === 1 && Auth::userid() === 1) { if (($admin === 1 && Auth::userid() === 1) || ($admin != 1 && Auth::userid() != 1)) {
DB::query("UPDATE users SET status = ?, admin = ?, content = ? WHERE id = ?", [ DB::query("UPDATE users SET status = ?, admin = ?, content = ? WHERE id = ?", [
$accountstatus, $accountstatus,
$admin, $admin,
@ -33,7 +33,7 @@ if (isset($_POST['subbtn'])) {
$userId $userId
]); ]);
echo "Данные успешно обновлены."; echo "Данные успешно обновлены.";
} else { } else {
echo 'Не удалось обновить данные'; echo 'Не удалось обновить данные';
} }

View file

@ -22,7 +22,6 @@ use \App\Models\User;
<h1><?= $_GLOBAL['title'] ?></h1> <h1><?= $_GLOBAL['title'] ?></h1>
<div class="p20" style="padding:20px"> <div class="p20" style="padding:20px">
<?php <?php
$myfile = fopen($_SERVER['DOCUMENT_ROOT'].$_GLOBAL['rules'], "r") or die("Unable to open file!"); $myfile = fopen($_SERVER['DOCUMENT_ROOT'].$_GLOBAL['rules'], "r") or die("Unable to open file!");
echo fread($myfile,filesize($_SERVER['DOCUMENT_ROOT'].$_GLOBAL['rules'])); echo fread($myfile,filesize($_SERVER['DOCUMENT_ROOT'].$_GLOBAL['rules']));