Файл: forum/my_tems.php
Строк: 56
<?php
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("<a href='./'>Форум</a>/<b>Темы $the[login]</b> ($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()) {
$col = $db -> dbcount('COUNT(`id`)','golos',"`where`='forum' and `id_w` = '".$assoc['id']."'");
if($col>0){$st=$diz -> img('golos.png');}else{$st=null;}
if($assoc['status']==0){$status =''.$diz -> img('r.png').' '.$st.'';}
if($assoc['var']==1){$sta =''.$diz -> img('zak.png').'';}
elseif($assoc['status']==1){$status=''.$sta.''.$diz -> img('close.png').''.$st.'';}
$usmax = $db -> dbcount('max(`id`)','forum_posts','`tema`='.$assoc['id'].'');
$max = $db -> query("SELECT * FROM `forum_posts` where `id`='$usmax'")-> fetch_assoc();
$usmin = $db -> dbcount('min(`id`)','forum_posts','`tema`='.$assoc['id'].'');
$min = $db -> query("SELECT * FROM `forum_posts` where `id`='$usmin'")-> fetch_assoc();
$user = $db -> query("SELECT * FROM `users` where `id`='".$max['user']."' ")-> fetch_assoc();
$autor = $db -> query("SELECT * FROM `users` where `id`='".$min['user']."' ")-> fetch_assoc();
$cid = $db -> dbcount('COUNT(`id`)','forum_posts'," `tema` = '".$assoc['id']."'");
$tot = intval(($cid - 1) / $num) + 1;
echo '<div class="fon">'.$status.' <a href="tema'.$assoc['id'].'">'.$assoc['name'].'</a>('.$cid.')
<a href="tema.php?id='.$assoc['id'].'&page='.$tot.'">>></a><br/>
<a href="'.ROOT.'id'.$autor['id'].'">'.$autor['login'].'</a>/<a href="'.ROOT.'id'.$user['id'].'">'.$user['login'].'</a> ('.$func -> times(date('d m Y H:i:s',$max['time'])).')</div>';
}
$act = 'my_tems.php?id='.$id.'';
echo ''.$func -> pagenav($act,$page,$total).'';
} else echo '<div class="fon">У '.$the['login'].' пока нет созданных тем</div>';
}else header('location: ./');
}else header('location: /aut.php');
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>