View file forum/search.php

File size: 1.45Kb
<?php
/*
------------------------------
##############################
-       Загруз Центр         -
-         by Kemel           -
-		   Форум			 -
##############################
------------------------------
*/
define('Loads',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
switch($do) {
case 'newposts':
$diz -> head('Форум');
$diz -> title('Последние темы');
$count = $db -> dbcount('COUNT(`id`)','forum',"`type` = 'm' AND `time` > '".(time() - 1800)."'");
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`,`text`,`time` FROM `forum` WHERE `type` = 'm' AND `time` > '".(time() - 1800)."' ORDER BY `id` DESC LIMIT ".$start.",".$num);
$msg = '<strong>Сообщений - '.$count.'</strong><br/>';
while ($assoc = $for -> fetch_assoc()) {
$msg .= '<div class="shapka"><strong>'.$assoc['name'].'</strong>('.$f -> times(date('d m Y H:i:s',$assoc['time'])).')'.$dop.'</div>'.
$assoc['text'];
}
$act = 'search.php?do=newposts';
$msg .= '<br/>'.$func -> pagenav($act,$page,$total).'<br/>';
} else {
$msg = 'Новых тем/сообщений нет';
}
$diz -> out($msg);
break;
}
?>