Файл: app/admin/users.php
Строк: 8
<?php
if (!$user->isAuth() or $user->get()->role < 1) {
redirect('/');
exit;
}
$all = $db->prepare('SELECT * FROM `users` ORDER BY `user_id` DESC');
$all -> execute([$user->get()->user_id]);
$all = $all -> fetchAll();
if(isset($_GET['del'])){
$sql = $db->prepare('delete from users where user_id = ?');
$sql -> execute([Clean :: int($_GET['del'])]);
Notif :: message('Пользователь успешно удален');
exit;
}
$peger = new ArrayPaginator('/admin/users', 10);
$items = $peger->getItems($all);
echo $template->render('admin.users',
['peger' => $peger,
'items' => $items,
]
);