<?php
require'f_forumm.php';
require'f_conectare.php';
conectare('cauta în forum','cauta-in-forum');
$titlu='Caută în forum';
$back[2]='<a href="/cautare">'.img('search.png',2).'Cautare</a>';
require'f_sus.php';
echo$div[4].img('search.png',2).'Caută în forum'.$div[5];
if($pmtext!=''||$go!='')
{
$go=rawurldecode($go);
if($pmtext!='')
$go=$pmtext;
$sin=(isset($_POST['sin'])?$_POST['sin']:$_GET['sin']);
$sor=(isset($_POST['sor'])?$_POST['sor']:$_GET['sor']);
$x2='?sin='.$sin.'&amp;sor='.$sor.'&amp;go='.rawurlencode($go);
if($sin==1)
{
$where_table='`forum_postari`';
$cond='`text`';
$select_fields='`id`,`tid`';
if($sor==1)
$ord_fields='`data`';
else
$ord_fields='`data`DESC ';
}
elseif($sin==2)
{
$where_table='`forum_topicuri`';
$cond='`text`';
$select_fields='`nume`,`id`';
if($sor==1)
$ord_fields='`data`';
else
$ord_fields='`data`DESC ';
}
elseif($sin==3)
{
$where_table='`forum_topicuri`';
$cond='`nume`';
$select_fields='`nume`,`id`';
if($sor==1)
$ord_fields='`data`';
else
$ord_fields='`data`DESC ';
}
$elemente=$conn->query('SELECT COUNT(*)FROM'.$where_table.'WHERE'.$cond.'LIKE"%'.$go.'%"')->fetch_row()[0];
if($elemente>0)
{
require'f_paginare1.php';
$items=$conn->query('SELECT'.$select_fields.'FROM'.$where_table.'WHERE'.$cond.'LIKE"%'.$go.'%"ORDER BY'.$ord_fields.'LIMIT '.$limit_start.','.$pe_pagina);
while($item=$items->fetch_row())
{
echo$div[1];
if($sin==1)
{
$tnuma=$conn->query('SELECT`nume`,`fid`FROM`forum_topicuri`WHERE`id`="'.$item[1].'"')->fetch_row();
echo(!forum($tnuma[1])?'<strong>Topic privat.</strong>':'<a href="/forum/topic/'.$item[1].'-'.seo($tnuma[0]).'/tip/'.$item[0].'">'.htmlspecialchars($tnuma[0]).'</a>');
}
else
echo(!forum($conn->query('SELECT`fid`FROM`forum_topicuri`WHERE`id`="'.$item[1].'"')->fetch_row()[0])?'<strong>Topic privat.</strong>':'<a href="/forum/topic/'.$item[1].'-'.seo($item[0]).'">'.htmlspecialchars($item[0]).'</a>');
echo$div[0];
}
require'f_paginare2.php';
}
else
echo$div[7].'Nu sunt rezultate!'.$div[0];
require'f_jos.php';
}
$form[0]='/cauta-in-forum" method="post';
$form[1]=1;
require'f_scris3.php';
$form[2]=$div[1].'Text:<br /><input name="pmtext" maxlength="77" />'.$div[0].$div[1].'Cauta in:<br />'.scris3('sin','1,,Texte postări::2,,Texte topicuri::3,,Nume topicuri','1').$div[0].$div[1].'Ordonare dupa:<br />'.scris3('sor','1,,Data postării (ascendent)::2,,Data postării (descendent)','1').$div[0];
$form[3]='pmtext::sin::sor';
$form[4]='Cauta';
require'f_form.php';
require'f_jos.php';