Файл: adm_panel/accesses.php
Строк: 74
<?php
/* Мод "Панель управления"
* Версия v0.0.1
* Дата последнего редактирования 31.01.2015
* Двиг 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 style = 'font-size: 18px;font-weight: bold;' class = 'razd'>" . img24('panel.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 = 'button sign-ins'>" . img16('save.png') . " Сохранить";
echo "</button></form>n";
echo "<div class = 'razd'>" . img16('left.png') . " <a href = 'accesses.php'>Группы</a></div>";
echo "<div class = 'razd'>" . img16('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 style = 'font-size: 18px;font-weight: bold;' class = 'razd'>" . img24('panel.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 img16('romb.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 "<div class = 'razd'><a href = '/adm_panel/' class = 'add'>" . img16('left.png') . " Панель управления</a></div>";
}
require_once H . 'sys/inc/tfoot.php';