Размер файла: 2.65Kb
<?php
$title='Поиск по форуму';
require"../system/config.php";
require"../system/func.php";
require"../system/head.php";
require"../system/error.php";
echo'<div class="i">'.$title.'<br></div>';
switch($_GET['act']){
case 'go':
echo'<form action="search.php?" method="get">Введите,что исчите:<br />
<input name="see" type="text" size="18" class="form" value=""/><br />Искать:<br><select name="g" class="form"><option value="1">В названиях</option><option value="2">В сообщениях</option></select><br>
<input type="submit" value="Искать" class="but"></form>';
break;
default:
$g=cifry($_GET['g']);
$see=prov($_GET['see']);
if($g==0 or $g=="" or $see==""){echo'Произошла ошибка'; require"../system/foot.php"; exit;}
if($g==1 or $g==2){}else{echo'Произошла ошибка'; require"../system/foot.php"; exit;}
if($g==1){
$adata=mysql_query("SELECT * FROM `forum_themes` WHERE `ftname` LIKE '%".$see."%'");
}
if($g==2){
$adata=mysql_query("SELECT * FROM `forum_messages` WHERE `fmtext` LIKE '%".$see."%'");
}
$kol=mysql_num_rows($adata);
$total=cifry($kol);
$page = abs((int)$_GET['page']);
if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
if($kol==0){
echo'<div class="p">
По вашему запросу, ничего не найдено..<br>
</div>';
}else{ echo'<div class="i">Результатов '.$kol.'<br></div>';
if($g==1){
$sdata=mysql_query("SELECT * FROM `forum_themes` WHERE `ftname` LIKE '%".$see."%' ORDER BY `timer` DESC LIMIT $page,10");}
if($g==2){
$sdata=mysql_query("SELECT * FROM `forum_messages` WHERE `fmtext` LIKE '%".$see."%' ORDER BY `timer` DESC LIMIT $page,10");}
while($ofile=mysql_fetch_array($sdata)){
$idkd=$ofile['id_them'];
echo'<div class="p">';
$oofile=mysql_fetch_array(mysql_query("SELECT * FROM `forum_themes` WHERE `id_them`='$idkd'"));
echo'Тема: <a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/">'.$oofile['ftname'].'</a> ';
$messages=mysql_num_rows(mysql_query("SELECT * FROM `forum_messages` WHERE `id_them`='$idkd'")); if($messages>10){ $stbud=round($messages,-1); $skcf=strlen($messages);
$poslc=substr($messages,($skcf-1),$skcf);
if($poslc>=5 or $poslc=='0'){$stbud=$stbud-10;}
echo'[<a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/page='.$stbud.'"><b>»</b></a>]';
}
echo'<br>Дата: '.date_fixed($ofile['timer']).'<br>Сообщение: '.vizual(mb_substr($ofile['fmtext'],0,250,'UTF-8')).'</div> ';
}
strpage($page, 10, $total, "search.php");}
break;
} require"../system/foot.php";
?>