Файл: panel/accesses.php
Строк: 58
<?php
/* DCMS Special
* Дата последнего редактирования 14.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'adm_check', 'user') as $inc) {
require_once "../sys/inc/{$inc}.php";
}
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'] = 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('Привилегии успешно изменены');
}
aut();
#Навигация
echo "<ol class='breadcrumb'>";
echo "<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo "<li><a href='/panel/'>Панель управления</a></li>";
echo "<li class='active'>Привилегии пользователей</li>";
echo "</ol>";
echo "<form method='post' class='list-group-item' 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 class='c-input c-checkbox'><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' /><span class='c-indicator'></span> $post[name]</label><br />n";
}
echo "<button name='accesses' class='btn btn-success'><span class='fa fa-save fa-fw'></span> Сохранить</button>";
echo "</form>n";
echo "<div class='list-group-item'><a href='accesses.php'><span class='fa fa-arrow-left fa-fw'></span> Группы</a></div>";
require_once H . 'sys/inc/tfoot.php';
}
$set['title'] = 'Группы пользователей';
require_once H . 'sys/inc/thead.php';
aut();
#Навигация
echo "<ol class='breadcrumb'>";
echo "<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo "<li><a href='/panel/'>Панель управления</a></li>";
echo "<li class='active'>Привилегии пользователей</li>";
echo "</ol>";
$accesses = mysql_query("SELECT * FROM `user_group` ORDER BY `id` ASC");
while ($res = mysql_fetch_assoc($accesses)) {
echo "<div class='list-group-item'>";
echo "<div style='float:right;'>";
echo "<font color='grey' title='Уровень'><small>$res[level]</small></font>";
echo "</div>";
echo "<a href='?id_group=$res[id]'>$res[name]</a><br />";
echo "<small><font color='grey'>Привелегий " . mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = '$res[id]'"), 0) . "</font></small><br />";
echo "</div>";
}
require_once H . 'sys/inc/tfoot.php';