<!--#include file="conn.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="config.asp"-->

<%
dim key
key=request.QueryString("key")

	dim show
	show=ReadTemplate("template/list_temp.html")
	show=replace(show,"{$siteinfo}",sitename&" - 搜索"""&key&"""")
    show=replace(show,"{$list_fl}",list_fl())
	show=replace(show,"{$wtlx}","")
	show=replace(show,"{$wt_list}",wt_list())
	webtop=ReadTemplate("template/webtop.html")
	webbottom=ReadTemplate("template/webbottom.html")
	webright=ReadTemplate("template/webright.html")
	show=replace(show,"{$WebTop}",webtop)
	show=replace(show,"{$WebBottom}",webbottom)
	show=replace(show,"{$WebRight}",webright)
    response.Write(show)

Function list_fl()
dim str
str="<table width=""100%""  border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbcrlf
str=str&"<tr>"&vbcrlf
str=str&"<td height=""30"">&nbsp;&nbsp;&nbsp;&nbsp;<b><font style=""font-size:14px"">您的位置：</font></b><a href=""index.html"" class=""show_top"">首页</a> → <font style=""font-size:14px"" color=""#339933"">搜索："&key&"</font>"
str=str&"</td></tr>"&vbcrlf
list_fl=str&"</table>"&vbcrlf
End Function

function wt_list()
on Error Resume Next
dim rs,sql,k,keys
set rs=server.CreateObject("adodb.recordset")
if key<>"" then 
   for k=1 to len(key)
     keys=mid(key,k,2)
     sql ="Select * from kw_wt where bt like '%"&keys&"%' order by id"
   next
else
     sql ="Select * from kw_wt order by id"
end if
rs.open sql,conn,1,1

if rs.eof and rs.bof then
       str="<font>&nbsp;&nbsp;暂无您要查找的信息!!</font>"
else
str="<table width=""100%"" border=""0"" cellspacing=""1"" cellpadding=""0"">"&vbcrlf
str=str&"<tr align=""center"" bgcolor=""#D8D8D8"">"&vbcrlf
str=str&"<td height=""25"">标题</td>"&vbcrlf
str=str&"<td width=""7%"">悬赏分</td>"&vbcrlf
str=str&"<td width=""5%"">人气</td>"&vbcrlf
str=str&"<td width=""7%"">回答数</td>"&vbcrlf
str=str&"<td width=""5%"">状态</td>"&vbcrlf
str=str&"<td width=""16%"">时间</td></tr>"&vbcrlf

    dim page,maxperpage,n
        page=clng(Request.QueryString("page"))
        maxperpage=28  '最大每页数
        if page<1 then page=1
        If rs.recordcount Mod maxperpage = 0 Then
            n = rs.recordcount \ maxperpage
        else
            n = rs.recordcount \ maxperpage + 1
        end If
		if page>n then page=n
     '关键分页设置
        rs.move (Page-1)*MaxPerPage
        dim bookmark
        bookmark=rs.bookmark
     '关键分页设置
	 do while not rs.eof
	 str=str&"<tr bgcolor=""#F6F6F6"">"&vbcrlf
	 str=str&"<td height=""26"">&nbsp;<a href=""list.asp?dl="&server.URLEncode(rs("dalei"))&"&xl="&server.URLEncode(rs("xiaolei"))&""" target=""_blank""><font class=""font_fl"">["&rs("xiaolei")&"]</font></a> <a href=""show/"&rs("wt_filename")&""" target='_blank' class=""bt"">"&rs("bt")&"</a></td>"&vbcrlf
     str=str&"<td align=""center"">"&rs("xsf")&"</td>"&vbcrlf
	 str=str&"<td align=""center"">"&rs("djs")&"</td>"&vbcrlf
	 str=str&"<td align=""center"">"&vbcrlf
	       	
			dim rs1,sql1
	        set rs1=server.CreateObject("adodb.recordset")
	        sql1 ="Select * from kw_hd where hdques='"&rs("wt_filename")&"'"
	        rs1.open sql1,conn,1,1
	        if rs1.recordcount=0 then
	        str=str&"<img src=""images/no_an.gif"">"
	        else
	        str=str&rs1.recordcount
	        end if
			rs1.close
			set rs1=nothing
			
			str=str&"</td>"&vbcrlf
			str=str&"<td align=""center"">"&vbcrlf
				if rs("zt")=1 and rs("gq")=1 then
	            str=str&"<img src=""images/no_point.gif"" title=""等待解决"">"
	            elseif rs("zt")=2 then
	            str=str&"<img src=""images/yes_point.gif"" title=""已经解决"">"
	            elseif rs("zt")=3 then
	            str=str&"<img src=""images/wu_point.gif"" title=""无满意答案"">"
	           elseif rs("gq")=2 then
	           str=str&"<img src=""images/gq_point.gif"" title=""问题过期"">"
	           end if
	   str=str&"</td>"&vbcrlf
	   str=str&"<td>"&FormatDateTime(rs("twtime"),2)&"&nbsp;"&FormatDateTime(rs("twtime"),4)&"</td>"&vbcrlf 
	   str=str&"</tr>"&vbcrlf
			   
	rs.movenext
	i=i+1
	if i>=MaxPerPage then exit do
	loop
	str=str&"</table>"&vbcrlf
if n>1 then
str=str&"<table width=""100%"" align=""center"" cellpadding=""0"" cellspacing=""0"">"&vbcrlf
str=str&"<tr>"&vbcrlf
str=str&"<td align=""center"" height=""30"">"&vbcrlf
str=str&"<a href=""list2.asp?page=1&key="&key&"""><font style=""font-size:14px"">首页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<a href=""list2.asp?page="&page-1&"&key="&key&"""><font style=""font-size:14px"">上页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<a href=""list2.asp?page="&page+1&"&key="&key&"""><font style=""font-size:14px"">下页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<a href=""list2.asp?page="&n&"&key="&key&"""><font style=""font-size:14px"">尾页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<select name=""page"" onchange=""javascript:window.location='list2.asp?key="&key&"&page='+this.options[this.selectedIndex].value;"">"&vbcrlf
	  dim ii
	  for ii=1 to n
str=str&"<option value="""&ii&""""
if page=ii then
  str=str&"selected"
end if
str=str&">"&ii&"</option>"&vbcrlf
     next
str=str&"</select>"&vbcrlf
str=str&"</td></tr></table>"&vbcrlf
end if
end if
wt_list=str
end function
%>