Файл: forum/poisk.php
Строк: 55
<?php
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
$act = isset($_GET['act']) ? trim($_GET['act']) : false;
if ($aut) {
///Главная
$diz -> head('Поиск по форуму');
$diz -> title('Поиск по форуму');
if (!isset($_POST['submit'])) {
echo '<div class="fon"><form action="poisk.php" method="POST">
Тип поиска:<br/><select name="tip"><option value="name">По темам</option><option value="text">В сообщениях</option></select><br/>
Запрос:<br/><input type="text" name="zap" value="" maxlength="40"/><br/>
<input type="submit" name="submit" value="Найти"/></form></div>';
echo '<div class="levo"><a href="./index.php" class="levo_tuch">'.$diz -> img('back.png').' Назад</a></div>';
} else {
$diz -> head('Результат поиска');
$zap = shit($_POST['zap']);
if(mb_strlen($func->delprobel($zap))>=2){
if($_POST['tip']=='name')
if($_POST['tip']=='name')
{$count = $db -> dbcount("COUNT(`id`)","forum_tems","`name` like '%".$zap."%'");}
elseif($_POST['tip']=='text')
{$count = $db -> dbcount("COUNT(`id`)","forum_posts","`text` like '%".$zap."%'");}
if ($count > 0) {
if($_POST['tip']!='text'){
$sql = $db -> query("SELECT * FROM `forum_tems` WHERE `name` like '%".$zap."%' ORDER BY `id` DESC");
while ($arr = $sql -> fetch_assoc()) {
$p = $db -> query("SELECT * FROM `forum_posts` WHERE `tema` = '".$arr['id']."'")-> fetch_assoc();
if($arr['status']==0){$status=$diz -> img('r.png');}
elseif($arr['status']==1){$status=$diz -> img('close.gif');}
$poster = $db -> dbcount('login','users',"`id` = '".(int)$p['user']."'");
$cid = $db -> dbcount('COUNT(`id`)','forum_posts'," `tema` = '".$arr['id']."'");
echo '<div class="fon">'.$status.' <a href="tema'.$arr['id'].'">'.$arr['name'].'</a>('.$cid.')
<a href="tema.php?id='.$arr['id'].'">>></a><br/><a href="'.ROOT.'id'.$p['user'].'">'.$poster.'</a> ('.$func -> times(date('d m Y H:i:s',$p['time'])).')</div>';
}
}else{
$sql = $db -> query("SELECT * FROM `forum_posts` WHERE `text` like '%".$zap."%' ORDER BY `id` DESC");
while ($arr = $sql -> fetch_assoc()) {
$p = $db -> query("SELECT * FROM `forum_tems` WHERE `id` = '".$arr['tema']."'")-> fetch_assoc();
if($arr['status']==0){$status=$diz -> img('r.png');}
elseif($arr['status']==1){$status=$diz -> img('close.gif');}
$poster = $db -> dbcount('login','users',"`id` = '".$arr['user']."'");
$cid = $db -> dbcount('COUNT(`id`)','forum_posts');
$text = $func -> tags($func -> smiles($arr['text']));
echo '<div class="fon">'.$status.' <a href="tema'.$p['id'].'">'.$p['name'].'</a>('.$cid.')
<a href="tema.php?id='.$p['id'].'">>></a><br/><a href="'.ROOT.'id'.$arr['user'].'">'.$poster.'</a> ('.$func -> times(date('d m Y H:i:s',$p['time'])).')</br>'.$text.'</div>';
}
}
} else $msg.='<div class="fon">Ни чего не найдено,попробуйте уточнить запрос поиска!</div>';
echo '<div class="levo"><a href="./poisk.php" class="levo_tuch">'.$diz -> img('back.png').' Назад</a></div>';
echo '<div class="levo"><a href="./index.php" class="levo_tuch">'.$diz -> img('back.png').' Форум</a></div>';
}else header('location: ?');
}
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
} else header('location: '.ROOT.'aut.php');
?>