Файл: adm_panel/accesses.php
Строк: 76
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../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']=output_text('Группа "'.$group['name'].'" - привилегии');
include_once '../sys/inc/thead.php';
title();
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 '<div class="block">';
echo '<form method="post" action="?id_group='.$group[id].'&'.$passgen.'">';
$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'].'</br>';
echo '</label>';
}
echo '<input class="button" value="Применить" name="accesses" type="submit">';
echo '</form>';
echo '</div>';
if (user_access('adm_panel_show')){
echo '<a class="link3" href="/adm_panel/"><i class="material-icons icon">keyboard_arrow_left</i> Админ панель</a>';
}
include_once '../sys/inc/tfoot.php';
}
$set['title']='Группы пользователей';
include_once '../sys/inc/thead.php';
title();
aut();
$accesses=mysql_query("SELECT * FROM `user_group` ORDER BY `id` ASC");
while ($res = mysql_fetch_assoc($accesses)){
echo '<a class="link3" href="?id_group='.$res[id].'"><i class="material-icons icon">verified_user</i> '.$res[name].' (L'.$res[level].', '.mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = '$res[id]'"),0).')</a>';
}
if (user_access('adm_panel_show')){
echo '<a class="link3" href="/adm_panel/"><i class="material-icons icon">keyboard_arrow_left</i> Админ панель</a>';
}
include_once '../sys/inc/tfoot.php';
?>