Файл: forum/search.php
Строк: 74
<?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="?" 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 ($assoc = $sql -> fetch_assoc()) {
if($assoc['status']==0){$status =''.$diz -> img('r.png').'';}
if($assoc['var']==1){$sta =''.$diz -> img('zak.png').'';}
elseif($assoc['status']==1){$status=''.$sta.''.$diz -> img('close.png').'';}
$max = $db -> query("SELECT `user`,`time` FROM `forum_posts` where `tema`='".$assoc['id']."' order by `id` desc")-> fetch_assoc();
$cid = $db -> dbcount('COUNT(`id`)','forum_posts'," `tema` = '".$assoc['id']."'");
$tot = intval(($cid - 1) / $num) + 1;
echo '<table width="100%" cellpadding=0 cellspacing=0><tr valign="top">
<td width="95%">
<a href="tema'.$assoc['id'].'" class="mail">
'.$sta.' '.$status.' '.$assoc['name'].' <span class="count">'.$cid.'</span> <br/>
'.$func->famname($assoc['user'],0).'/'.$func->famname($max['user'],0).' '.$func -> vremja($max['time']).'</div>
</a></td>
<td><div class="menu"><a href="tema.php?id='.$assoc['id'].'&page='.$tot.'" class="menutuch">>></a></div></td>
</tr></table>';
}
}else{
$sql = $db -> query("SELECT * FROM `forum_posts` WHERE `text` like '%".$zap."%' ORDER BY `id` DESC");
while ($assoc = $sql -> fetch_assoc()) {
$tname = $db -> dbcount('name','forum_tems',"`id` = '".$assoc['tema']."'");
echo '<div class="menu">
<a href="tema'.$assoc['tema'].'" class="menutuch">'.$tname.' ('.$func -> times(date('d m Y H:i:s',$assoc['time'])).')</a></div>
<div class="fon">
<table><tr valign="top"><td>'.$func->avatar($assoc['user']).'</td>
<td style="padding-left:5px;">'.$func->famname($assoc['user']).'';
echo ' '.$func -> times(date('d m Y в H:i',$assoc['time'])).'</br>
<br/>'.$func -> tags($func -> smiles($assoc['text'])).'';
echo'</td></tr></table></div>';}
}
} else $msg.='<div class="fon">Ни чего не найдено,попробуйте уточнить запрос поиска!</div>';
echo '<div class="levo"><a href="?" 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');
?>