';
if($_POST['title_op']=='1') $title_op ='AND';
else $title_op = 'OR';
if($_POST['text_op']=='1') $text_op ='AND';
else $text_op = 'OR';
if($_POST['order']=='1') $order='DESC';
else $order='ASC';
switch($_POST['table']) {
case '1': $table='news'; break;
case '2': $table='articles'; break;
default: $table='forum'; break;
}
$after=mktime(0,0,0,$am,$ad,$ay);
$before=mktime(0,0,0,$bm,$bd,$by);
if($after<1) $after=0;
if($before<1) $before=time();
if($table=="forum") {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."forum_posts WHERE ( message LIKE '%$title1%' $text_op message LIKE '%$title2%' ) AND
( message LIKE '%$text1%' $text_op message LIKE '%$text2%' ) AND
( date between $after AND $before ) ORDER BY date $order ");
}
elseif($table=="news") {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."news WHERE ( headline1 LIKE '%$title1%' OR headline2 LIKE '%$title1%' ) $title_op
( headline1 LIKE '%$title2%' OR headline2 LIKE '%$title2%' ) AND
( content1 LIKE '%$text1%' OR content2 LIKE '%$text1%' ) $text_op
( content1 LIKE '%$text2%' OR content2 LIKE '%$text2%' ) AND
( date between $after AND $before ) ORDER BY date $order");
}
else {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."$table WHERE ( title LIKE '%$title1%' $title_op title LIKE '%$title2%' ) AND
( content LIKE '%$text1%' $text_op content LIKE '%$text2%' ) AND
( date between $after AND $before ) ORDER BY date $order");
}
$anz=mysql_num_rows($ergebnis);
echo"
';
$tables=array('articles', 'forum_posts', 'news');
foreach($tables as $table) {
if($table=="forum_posts") $ergebnis=safe_query("SELECT * FROM ".PREFIX."forum_posts WHERE message LIKE '%$search%' ORDER BY date DESC");
elseif($table=="news") $ergebnis=safe_query("SELECT * FROM ".PREFIX."news WHERE ( headline1 LIKE '%$search%' OR headline2 LIKE '%$search%' ) OR ( content1 LIKE '%$search%' OR content2 LIKE '%$search%' ) ORDER BY date DESC");
else $ergebnis=safe_query("SELECT * FROM ".PREFIX."$table WHERE title LIKE '%$search%' OR content LIKE '%$search%' ORDER BY date DESC");
while($ds=mysql_fetch_array($ergebnis)) {
if($table=="articles") $tableid="articlesID";
if($table=="forum_posts") $results[]=$ds[date].':***:forum:***:'.$ds[topicID].':***:'.$ds[message].':***:'.$ds[poster].':***:'.$ds[topicID].':***:'.$ds[boardID];
elseif($table=="news") $results[]=$ds[date].':***:news:***:'.$ds[headline1].':***:'.$ds[content1].':***:'.$ds[poster].':***:'.$ds[newsID].':***:0';
else $results[] = $ds[date].':***:'.$table.':***:'.$ds[title].':***:'.$ds[content].':***:'.$ds[poster].':***:'.$ds[$tableid].':***:0';
}
}
$anz=count($results);
echo"