Файл: forum/my_tems.php
Строк: 54
<?
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if ($aut == true) {
if ($id) {
$type = $db -> query("SELECT `id`,`login` FROM `users` WHERE `id` = '$id'");
if ($type -> num_rows > 0) $the = $type -> fetch_assoc(); else $the = false;
} else $the = false;
if($type -> num_rows > 0){
//Выводим темы
$diz -> head('Темы '.$the['login'].'');
$m_tems = $db -> dbcount('count(`id`)','forum_tems',"`user` = '".$id."'");
$diz -> title("Темы $the[login] ($m_tems)");
$count = $db -> dbcount('COUNT(`id`)','forum_tems',"`user` = '".$id."'");
if ($count > 0) {
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$for = $db -> query("SELECT `id`,`name`,`user` FROM `forum_tems` WHERE `user` = '".$id."' order by `uptime` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
if($assoc['status']==0)$status =''.$diz -> img('r.png').'';
if($assoc['var']==1){$sta =''.$diz -> img('zak.png').'';}
elseif($assoc['status']==1){$status=''.$sta.''.$diz -> img('close.png').'';}
$max = $db -> query("SELECT `user`,`time` FROM `forum_posts` where `tema`='".$assoc['id']."' order by `id` desc")-> fetch_assoc();
$cid = $db -> dbcount('COUNT(`id`)','forum_posts'," `tema` = '".$assoc['id']."'");
$tot = intval(($cid - 1) / $num) + 1;
echo '<table width="100%" cellpadding=0 cellspacing=0><tr valign="top">
<td width="95%">
<a href="tema'.$assoc['id'].'" class="mail">
'.$sta.' '.$status.' '.$assoc['name'].' <span class="count">'.$cid.'</span> <br/>
'.$func->famname($assoc['user'],0).'/'.$func->famname($max['user'],0).' '.$func -> vremja($max['time']).'</div>
</a></td>
<td><div class="menu"><a href="tema.php?id='.$assoc['id'].'&page='.$tot.'" class="menutuch">>></a></div></td>
</tr></table>';
}
$act = 'my_tems.php?id='.$id.'';
echo ''.$func -> pagenav($act,$page,$total).'';
} else echo '<div class="fon">У '.$the['login'].' пока нет созданных тем</div>';
}else header('location: '.ROOT.'id'.$id);
}else header('location: '.ROOT.'aut.php');
echo '<div class="levo"><a href="'.ROOT.'forum/" class="levo_tuch">'.$diz -> img('back.png').' Назад</a></div>';
echo '<div class="levo"><a href="'.ROOT.'" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>