<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/../include/pub_datalist_dm.php");
require_once(dirname(__FILE__)."/../include/inc_functions.php");
$sad = ereg_replace("[^g|t]","",$sad);
if(empty($sad)) $sad = "t";
if(empty($keyword)){
	ShowMsg("´íÎó,ÇëÊäÈëËÑË÷¹Ø¼ü×Ö£¡","-1");
	exit(); 
}
if($sad=="g"){
	$searchtable = "#@__groups";
	$WhereSql = "WHERE ishidden=0 AND groupname like '%".$keyword."%'";
	$Orders = "ORDER BY stime DESC";
}else{
	$searchtable = "#@__group_threads";
	$WhereSql = "WHERE closed=0 AND subject like '%".$keyword."%'";
	$Orders = "ORDER BY lastpost DESC";
}
$title = "ËÑË÷";
$sql = "SELECT * FROM $searchtable $WhereSql $Orders";
$dlist = new DataList();
$dlist->pageSize = 10;
$dlist->SetParameter("keyword",$keyword);
$dlist->SetParameter("sad",$sad);
$dlist->SetSource($sql);
if($sad=="g") require_once(dirname(__FILE__)."/templets/search_groups.htm");
else require_once(dirname(__FILE__)."/templets/search_topic.htm");
$dlist->Close();
?>