Просмотр файла accesses.php

Размер файла: 3.84Kb
<?php
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/user.php';

if(!isset($user) && !isset($_GET['id'])){
	header("Location: /index.php?".SID);
	exit;
	}

if(isset($user)){
	$ank['id']=$user['id'];
	}

if(isset($_GET['id'])){
	$ank['id']=intval($_GET['id']);
	}

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".$ank['id']."' LIMIT 1"),0)==0){
	header('Location: /index.php');
	exit;
	}

$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$ank['id']."' LIMIT 1"));
$set['title'] = $ank['nick'].' - привилегии &amp; '.$_SERVER['HTTP_HOST'];
include_once 'sys/inc/thead.php';

title();
aut();

echo '<div class="menu">';

if($ank['level']==0){
	echo '<div class=="p_t">Пользователь</div><div class=="p_m">';

$q=mysql_query("SELECT * FROM `accesses` WHERE `level` = '0' ORDER BY `type` ASC");
while ($post = mysql_fetch_array($q)){
	echo '<label>';
	$ch=NULL;

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user_acсess` WHERE `id_user` = '".$ank['id']."' AND `type` = '".$post['type']."' LIMIT 1"),0)==1){
	$ch=' checked="checked"';
	}

echo '<input type="checkbox" disabled="disabled"'.$ch.' name="'.$post['type'].'" value="1"/>'.$post['name'].'</label><br/>';
}
echo '</div></div>';
}


if($ank['level']==1){
	echo '<div class="p_t">Модератор</div><div class="p_m">';

$q=mysql_query("SELECT * FROM `accesses` WHERE `level` = '1' ORDER BY `type` ASC");
while($post = mysql_fetch_array($q)){
	echo '<label>';
	$ch=NULL;

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user_acсess` WHERE `id_user` = '".$ank['id']."' AND `type` = '".$post['type']."' LIMIT 1"),0)==1){
	$ch=' checked="checked"';
	}

echo '<input type="checkbox" disabled="disabled"'.$ch.' name="'.$post['type'].'" value="1"/>'.$post['name'].'</label><br/>';
}
echo '</div></div>';
}

if($ank['level']==2){
	echo '<div class="p_t">Супермодератор</div><div class="p_m">';

$q=mysql_query("SELECT * FROM `accesses` WHERE `level` = '2' ORDER BY `type` ASC");
while($post = mysql_fetch_array($q)){
	echo '<label>';
	$ch=NULL;

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user_acсess` WHERE `id_user` = '".$ank['id']."' AND `type` = '".$post['type']."' LIMIT 1"),0)==1){
	$ch=' checked="checked"';
	}

echo '<input type="checkbox" disabled="disabled"'.$ch.' name="'.$post['type'].'" value="1"/>'.$post['name'].'</label><br/>';
}
echo '</div></div>';
}


if($ank['level']==3){
	echo '<div class="p_t">Администратор</div><div class="p_m">';

$q=mysql_query("SELECT * FROM `accesses` WHERE `level` = '3' ORDER BY `type` ASC");
while($post = mysql_fetch_array($q)){
	echo '<label>';
	$ch=NULL;

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user_acсess` WHERE `id_user` = '".$ank['id']."' AND `type` = '".$post['type']."' LIMIT 1"),0)==1){
	$ch=' checked="checked"';
	}

echo '<input type="checkbox" disabled="disabled"'.$ch.' name="'.$post['type'].'" value="1"/>'.$post['name'].'</label><br/>';
}
echo '</div></div>';
}


if($ank['level']==4){
echo '<div class="p_t">Главный администратор</div><br/>';
echo '<div class="p_m">Имеет неограниченные привелегии</div>';
}

echo '</div>';
echo '<div class="foot">';

if(isset($access['user_access_ed'])){
	echo '&#187;&nbsp;<a href="/adm_panel/accesses.php?id='.$ank['id'].'">Изменить привилегии</a><br/>';
	}

echo '&#187;&nbsp;<a href="/info.php?id='.$ank['id'].'">На страничку</a><br/>';

echo '</div>';
include_once 'sys/inc/tfoot.php';
?>