Файл: adm_panel/accesses.php
Строк: 80
<?php
/* Мод "Панель управления"
* Версия v0.0.1
* Дата последнего редактирования 30.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Файл accesses.php
* Описание: привилегии пользователей
*/
require_once '../sys/inc/start.php';
require_once H . 'sys/inc/compress.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/adm_check.php';
require_once H . 'sys/inc/user.php';
user::access('adm_accesses', null, 'index.php?' . SID);
adm_check();
if (isset($_GET['id_group']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group` WHERE `id` = '" . intval($_GET['id_group']) . "'"), 0)) {
$group = mysql_fetch_assoc(mysql_query("SELECT * FROM `user_group` WHERE `id` = '" . intval($_GET['id_group']) . "'"));
$set['title'] = text::toOutput('Группа "' . $group['name'] . '" - привилегии');
require_once H . 'sys/inc/thead.php';
if (isset($_POST['accesses'])) {
mysql_query("DELETE FROM `user_group_access` WHERE `id_group` = '$group[id]'");
$q = mysql_query("SELECT * FROM `all_accesses`");
while ($post = mysql_fetch_assoc($q)) {
$type = $post['type'];
if (isset($_POST[$type]) && $_POST[$type] == 1) {
mysql_query("INSERT INTO `user_group_access` (`id_group`, `id_access`) VALUES ('$group[id]', '$post[type]')");
}
}
msg('Привилегии успешно изменены');
}
title();
aut();
#Навигация
echo "<div class = 'razd'><a href = '/index.php'>Главная</a> > <a href = '/umenu.php'>Кабинет</a> > <a href = '/adm_panel/'>Панель управления</a> > <a href = '?'><b>Привилегии пользователей</b></a></div>";
echo "<div style = 'font-size: 18px;font-weight: bold;' class = 'razdel'>" . img('other.png') . " Привилегии пользователей</div>";
echo "<form method = 'post' class = 'razd' action = '?id_group=$group[id]&$passgen'>n";
$q = mysql_query("SELECT * FROM `all_accesses` ORDER BY `name` ASC");
while ($post = mysql_fetch_assoc($q)) {
echo "<label>";
echo "<input type = 'checkbox'" . (mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = '$group[id]' AND `id_access` = '$post[type]' LIMIT 1"), 0) == 1 ? " checked = 'checked'" : null) . " name = '$post[type]' value = '1' />";
echo $post['name'];
echo "</label><br />n";
}
echo "<button name = 'accesses' class = 'action'>";
echo "<span class = 'label'><span class = 'icon icon67' /> Сохранить</span>";
echo "</button></form>n";
echo "<div class = 'razd'>" . img('left.png') . " <a href = 'accesses.php'>Группы</a></div>";
echo "<div class = 'razd'>" . img('left.png') . " <a href = '/adm_panel/'>Панель управления</a></div>";
require_once H . 'sys/inc/tfoot.php';
}
$set['title'] = 'Группы пользователей';
require_once H . 'sys/inc/thead.php';
title();
aut();
#Навигация
echo "<div class = 'razd'><a href = '/index.php'>Главная</a> > <a href = '/umenu.php'>Кабинет</a> > <a href = '/adm_panel/'>Панель управления</a> > <a href = '?'><b>Привилегии пользователей</b></a></div>";
echo "<div style = 'font-size: 18px;font-weight: bold;' class = 'razdel'>" . img('other.png') . " Привилегии пользователей</div>";
$accesses = mysql_query("SELECT * FROM `user_group` ORDER BY `id` ASC");
while ($res = mysql_fetch_assoc($accesses)) {
echo "<table class = 'razd'><tr><td class = 'icon14'>";
echo img('userss.png');
echo "</td><td class = 'null'>n";
echo "<a href = '?id_group=$res[id]'>$res[name] (Уровень $res[level])</a><br />";
echo "<small>Привелегий " . mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = '$res[id]'"), 0) . "</small><br />";
echo "</td></tr></table>";
}
if (user::access('adm_panel_show')) {
echo "<a href = '/adm_panel/'><div class = 'razd'>" . img('left.png') . " Панель управления</div></a>";
}
require_once H . 'sys/inc/tfoot.php';