Размер файла: 2.09Kb
<?
include('../core/core.php');
include(BASEDIR.INC.'func.php');
include(BASEDIR.INC.'session.php');
include(BASEDIR.INC.'session_user.php');
$mode = htmlspecialchars($_GET['mode']);
include(BASEDIR.INC.'head.php');
if(is_user()){
$users = mysql_query('SELECT * FROM users WHERE login = "'.$_COOKIE['login'].'"');
$users = mysql_fetch_assoc($users);
$admin = $users['status'];
$login = mysql_real_escape_string(htmlspecialchars($_GET['login']));
if($login == NULL){$login = $_COOKIE['login'];} else { $login = $login; }
show_title('Файлы пользователей!');
switch ($mode):
case 'index':
if($login == $_COOKIE['login']){echo '<div class="razdel">Мои группы</div>';} else {echo '<div class="razdel">Группы '.$login.'</div>';}
define('TOPAGE',10);
$page=(int)$_GET['page'];
$q=mysql_result(mysql_query("SELECT COUNT(*) FROM `grop_user` WHERE `login`='".$login."'"),0);
$total = intval(($q - 1) / TOPAGE) + 1;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * TOPAGE -TOPAGE;
$g=mysql_query("SELECT * FROM `grop_user` WHERE `login`='".$login."' ORDER BY `id` DESC LIMIT $start,".TOPAGE."");
while($u=mysql_fetch_array($g)){
$ss = mysql_query('SELECT * FROM grop WHERE id = "'.$u['id_grop'].'"');
$ss = mysql_fetch_assoc($ss);
echo'<div class="menu">';
echo'<a href="/grop/index.php?mode=see&id='.$ss['id'].'">'.$ss['name'].'</a>';
echo'</div>';
}
if ($page != $total) $nextpage = ' <a href="?mode=index&page='. ($page + 1) .'">Далее</a>';
if($page - 1 > 0) $pageback = '<a href="?mode=index&page='. ($page - 1) .'">Назад</a> ';
if($q == 0){ echo'Групп нету!'; }
echo''.$pageback.' '.$nextpage.'';
break;
default:
header ('location: ?mode=index');
endswitch;
echo'<a href="/">На главную</a>';
} else {echo '<div class="razdel">Доступ закрыт!</div>';
echo'<div class="menu">Доступ разрешен только зарегистированым!</div>';
}
include(BASEDIR.INC.'foot.php');
?>