<?php
require("../../class/connect.php");
include("../../data/cache/public.php");
include("../../class/db_sql.php");
include("../../class/q_functions.php");
include("../../data/cache/class.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//
$searchid=(int)$_GET['searchid'];
if(empty($searchid))
{
	printerror("ûص","history.go(-1)",1);
}
$page=(int)$_GET['page'];
$start=(int)$_GET['start'];
$search="&searchid=".$searchid;
$page_line=12;//ÿҳʾ
$line=20;//ÿҳʾ¼
$offset=$start+$page*$line;//ƫ
$add='';
$search_r=$empire->fetch1("select searchid,keyboard,result_num,classid,softtype,language,soft_sq,searchclass,ztid from {$dbtbpre}downsearch where searchid='$searchid'");
if(!$search_r[searchid])
{
	printerror("û","history.go(-1)",1);
}
//Ŀ
if($search_r[classid])
{
	if($class_r[$search_r[classid]][islast])//ռĿ
	{
		$add.="classid='$search_r[classid]' and ";
	}
	else
	{
		$add.="(".ReturnClass($class_r[$search_r[classid]][sonclass]).") and ";
	}
}
//ר
if($search_r['ztid'])
{
	$add.="ztid='$search_r[ztid]' and ";
}
//
if($search_r[softtype])
{
	$add.="softtype='$search_r[softtype]' and ";
}
//
if($search_r[language])
{
	$add.="language='$search_r[language]' and ";
}
//Ȩʽ
if($search_r[soft_sq])
{
	$add.="soft_sq='$search_r[soft_sq]' and ";
}
//ʽ
if($search_r[searchclass]==0)//ѯȫ
{
	$add.="(softname like '%$search_r[keyboard]%' or softsay like '%$search_r[keyboard]%')";
}
elseif($search_r[searchclass]==1)//ѯ
{
	$add.="softname like '%$search_r[keyboard]%'";
}
elseif($search_r[searchclass]==2)//˵ѯ
{
	$add.="softsay like '%$search_r[keyboard]%'";
}
else
{
	$add.="writer like '%$search_r[keyboard]%'";
}
$query="select softid,softname,softsay,classid,softtime,homepage,adduser,writer,filesize,filetype,demo,softpic,count_all,count_month,count_week,soft_sq,soft_fj,downfen,star,language,softtype,foruser,soft_version,titleurl,titlefont,count_day,filename,ztid from {$dbtbpre}down where ".$add;
$num=$search_r[result_num];
$query.=" order by softid desc limit $offset,$line";
$sql=$empire->query($query);
$listpage=page1($num,$line,$page_line,$start,$page,$search);
$url="<a href='../../'>ҳ</a>&nbsp;>&nbsp;<a href='".EDReturnSearchFormUrl()."'>߼</a>&nbsp;>&nbsp;";
$keyboard=$search_r[keyboard];
?>
<!--empire.listtemp.top-->
<?php
$strlen='[!--strlen--]';
$subtitle='[!--subtitle--]';
$formatdate='[!--formatdate--]';
while($r=$empire->fetch($sql))
{
	$softurl=EDReturnSoftPageUrl($r[filename],$r[titleurl]);//ӵַ
	//
	$thisclassurl=EDReturnClassUrl($r[classid]);
	$thisclassname=EdReturnClassname($r[classid]);
	$classname="[<a href='".$thisclassurl."'>".$thisclassname."</a>]&nbsp;";
	//Ȩʽ
	$soft_sq=$class_sqr[$r[soft_sq]][sqname];
	//
	$softtype="<a href='".EDReturnTypeUrl($r[softtype])."'>".$class_sr[$r[softtype]][softtype]."</a>";
	//
	$language=$class_lr[$r[language]][language];
	//ר
	$ztname="<a href='".EDReturnZtUrl($r[ztid])."'>".$class_zr[$r[ztid]][ztname]."</a>";
	//ͼƬ
	$softpic=$r[softpic]?$r[softpic]:$public_r[sitedown]."data/images/notimg.gif";
	//
	$softname=esub($r[softname],$subtitle);
	//
	$softsay=nl2br(GetEBBcode(esub(strip_tags(trim($r[softsay])),$strlen)));
	//ʱ
	$softtime=date($formatdate,$r[softtime]);
?>
<!--empire.listtemp.center-->
<?php
}
db_close();
$empire=null;
?>
<!--empire.listtemp.footer-->