Файл: soc-set/moduls/forum/search.php
Строк: 13
<?php
require_once('../../core/start.php');
check_auth();
head('Поиск тем');
echo DIV_TITLE . 'Поиск тем' . CLOSE_DIV;
$q = html($_POST['q']);
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUM_THEME." WHERE `name` LIKE '%".$q."%'");
echo DIV_LI . 'Найдено совпадений: <b>' . $all . '</b>' . CLOSE_DIV;
$n = new Navigator($all,5,'');
$sql = DB::$dbs->query("SELECT * FROM".FORUM_THEME." WHERE `name` LIKE '%".$q."%' LIMIT {$n->start()}, 5");
while($theme = $sql -> fetch()) {
$posts = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".FORUMS_POST." WHERE `theme_id` = ? ", array($theme['id']));
echo DIV_LI . '<a href="'.HOME.'/forum/'.$theme['forum_id'].'/'.$theme['forumc_id'].'/'.$theme['id'].'/">'.$theme['name'].'</a> ['.$posts.']' . CLOSE_DIV;
}
echo $n->navi();
echo DIV_GO . '<a href="'.HOME.'/">Главная</a> / <a href="'.HOME.'/forum/">Форум</a> / <b>Поиск тем</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
?>