View file forum/last.php

File size: 1.61Kb
<?php
/*
------------------------------
##############################
-       Загруз Центр         -
-         by Kemel           -
-		   Форум			 -
##############################
------------------------------
*/
define('ROOT','../');
define('Loads',true);
require_once (ROOT.'system/power.php');
$diz -> head('Форум');
$diz -> title('Последние 10 тем');
$num = isset($ya['num']) ? $ya['num'] : 10;
$sql = $db -> query("SELECT DISTINCT `fid` FROM `forum` WHERE `type` = 'm' ORDER BY `id` DESC LIMIT 0,10");
while ($assoc = $sql -> fetch_assoc()) {
$theme = $db -> query("SELECT `id`,`fid`,`name`,`text` FROM `forum` WHERE `id` = '".$assoc['fid']."' AND `type` = 't'") -> fetch_assoc();
$who = $db -> query("SELECT `name`,`time` FROM `forum` WHERE `fid` = '".$assoc['fid']."' AND `type` = 'm' ORDER BY `id` DESC LIMIT 1") -> fetch_row();
$cid = $db -> dbcount('COUNT(`id`)','forum',"`type` = 'm' AND `fid` = '".$assoc['fid']."'");
$total = intval(($cid - 1) / $num) + 1;
$razd = $db -> query("SELECT `id`,`name` FROM `forum` WHERE `id` = '".$theme['fid']."' AND `type` = 'r' LIMIT 1") -> fetch_assoc();
$msg .= '<div class="top"><a href="index.php?id='.$razd['id'].'">'.$razd['name'].'</a> -> 
<a href="index.php?id='.$theme['id'].'">'.$theme['name'].'</a>('.$cid.')
<a href="index.php?id='.$theme['id'].'&amp;page='.$total.'">>></a></div>'.
$who[0].'('.$func -> times(date('d m Y H:i:s',$who[1])).')';
}
$msg .= '<hr/>'.$diz -> img('folder.png').'<a href="index.php">Форум</a><br/>'.$diz -> img('home.png').'<a href="/index.php">На главную</a>';
$diz -> out($msg);
?>