<!--#include file="down_conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="down_function.asp" -->
<%
Dvbbs.LoadTemplates("")
Dvbbs.Stats="下载中心管理"
Dvbbs.Nav()'输出头
Dvbbs.Head_var 2,0,Dvbbs.Stats,""

	
	MaxPerPage=sonum	'每页显示程序最大数量
	Const ScriptTimeOut	= 300	'服务器ASP脚本超时时间值，建议不要使用 
	const makejs=0		'是否自动生成更新js文件，必须有Fso支持，请确认，默认为否
   	
   	dim totalPut,MaxPerPage
   	dim CurrentPage
   	dim TotalPages
   	'dim i,j
   	dim keyword
	'dim founderr
	'dim errmsg
	dim findword
	
	keyword=request("keyword")
	if keyword="" then
		FoundErrs  "<br>"+"<li>请输入查询条件。"
		keyword="请输入查询条件"
		if request("action")="title" then
			findword="showname like '%"&keyword&"%' "
		else
			findword="note like '%"&keyword&"%' "
		end if
	else
		keyword=replace(replace(replace(replace(keyword,"'","‘"),"<","&lt;"),">","&gt;")," ","&nbsp;")
		if request("action")="title" then
			findword="showname like '%"&keyword&"%' "
		else
			findword="note like '%"&keyword&"%' "
		end if
	end if
   	if not isempty(request("page")) then
      		currentPage=cint(request("page"))
   	else
      		currentPage=1
   	end if
 	set rs=server.createobject("adodb.recordset")
	dim classid,Nclassid
	dim classname,Nclassname

	if request("classid")="" then
		classid=""
		classname="所有软件"
'		classid="classid=1 and  "
'		sql="select class from Dclass where classid=1"
'		rs.open sql,conndown,1,1
'		classname=rs("class")
'		rs.close
	else
		classid="classid="&cstr(request("classid"))&" and  "
		sql="select class from Dclass where classid="&cstr(request("classid"))
		rs.open sql,conndown,1,1
		classname=rs("class")
		rs.close
	end if
	if request("Nclassid")="" then
		Nclassid=""
		Nclassname="所有软件"
	else
		Nclassid=" Nclassid="&cstr(request("Nclassid"))&" and  "
		sql="select Nclass from DNclass where Nclassid="&cstr(request("Nclassid"))
		rs.open sql,conndown,1,1
		Nclassname=rs("Nclass")
		rs.close
	end if

%>

<!-- #include file="down_Forum_js.asp" -->
<table  class="tableborder2" cellspacing=1 align=center>
        <tr>
          <th valign=middle height=25 width="100%"><%
	dim sql1,rs1
	set rs=server.createobject("adodb.recordset")
	sql="select class,classid from Dclass"
	rs.open sql,conndown,1,3
	do while not rs.eof
%>
<a href="down_index.asp?classid=<%=rs("classid")%>" onMouseOver='ShowMenu(classlist<%=rs("classid")%>,80)'><font color="ffffff"><%=rs("class")%></font></a>|        
<%
	rs.movenext
	loop
	rs.close
%></th>
</tr>
</table><br>
                                 
                                     
<%
	response.write "查询条件：<font color=red>"&keyword&"</font>"
	response.write "在"&classname&"的"&Nclassname&"中"
%>
<% set rs=server.createobject("adodb.recordset")

	if request("Nclassid")="" then
		sql="select * from download where "&classid&" "&findword&" "
		sql=sql&" order by id desc"
	else
		sql="select * from download where "&classid&" "&Nclassid&" "&findword&" "
		sql=sql&" order by id desc"
	end if
	rs.open sql,conndown,1,3

  	if rs.eof and rs.bof then 
       		response.write "<p align='center'>没有或没有找到任何程序</p>" 
   	else 
      		totalPut=rs.recordcount 
      		if currentpage<1 then 
          		currentpage=1 
      		end if 

      		if (currentpage-1)*MaxPerPage>totalput then 
	   		if (totalPut mod MaxPerPage)=0 then 
	     			currentpage= totalPut \ MaxPerPage 
	   		else 
	      			currentpage= totalPut \ MaxPerPage + 1 
	   		end if 
      		end if 
       		if currentPage=1 then 
            		showContent 
            		showpage totalput,MaxPerPage,"down_ru_query.asp" 
       		else 
          		if (currentPage-1)*MaxPerPage<totalPut then 
            			rs.move  (currentPage-1)*MaxPerPage 
            			dim bookmark 
            			bookmark=rs.bookmark 
            			showContent 
             			showpage totalput,MaxPerPage,"down_ru_query.asp" 
        		else 
	        		currentPage=1 
           			showContent 
           			showpage totalput,MaxPerPage,"down_ru_query.asp" 
	      		end if 
	   	end if 
   	rs.close 
   	end if 
	         
   	sub showContent 
       	dim i 
	   	i=0 
%>  
      <table   class="tableborder2" cellspacing="1" cellpadding="0" align=center>
      <tr>
        <th width="41%" height=22>软件名称和简介
  <th width="11%" align="center">推荐</td>
  <th width="20%" align="center">更新日期</td>
  <th width="14%" align="center">下载次数</td>
  <th width="14%" align="center">文件大小</td>
        </tr>
<%do while not rs.eof%>
        <tr bgcolor="#FFFFFF">
          <td width="100%" height=22 colspan="5"><IMG SRC="down_images/CLICK.GIF"><a href="down_list.asp?id=<%=rs("id")%>"><%=replace(rs("showname"),""&keyword&"","<font color=red>"&keyword&"</font>")%></a></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td width="41%" height=22 bgcolor="#FFFFFF"    >&nbsp;&nbsp;
          <%if len(rs("note"))>18 then%><%=left(rs("note"),18)%>……<%else%><%=rs("note")%><%end if%></td>
          <td width="11%"  align=center bgcolor="#FFFFFF"  ><%if rs("hot")>3 then%><font color=red>推荐</font><%end if%></td>
          <td width="20%" align=center bgcolor="#FFFFFF"  ><%=rs("dateandtime")%></td>
          <td width="14%" align=center bgcolor="#FFFFFF"  ><%=rs("hits")%></td>
          <td width="14%" align=center bgcolor="#FFFFFF"  ><%=rs("size")%></td>
        </tr>
        <tr bgcolor="#f5f5f5">
          <td width="100%" height=22 colspan="5">运行环境：<%=rs("system")%>  授权方式：<%=rs("orders")%></td>
        </tr>
    <tr>                     
      <td background=down_images/bg02.gif height=1 colspan="5" width=85%>    
      </td>                    
    </tr>
<%
	 i=i+1
	 if i>=MaxPerPage then exit do
	 	rs.movenext
	 loop
%>
</table>

<%
   end sub 

	function showpage(totalnumber,maxperpage,filename)
  	dim n,i,page

  	if totalnumber mod maxperpage=0 then
     		n= totalnumber \ maxperpage
  	else
     		n= totalnumber \ maxperpage+1
  	end if
  	response.write "<form method=Post action="&filename&"?classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">"
  	response.write "<p align='right'><font color='red'>"&Nclassname&"</font>"

  	if CurrentPage<2 then
    		response.write ""&totalnumber&"个&nbsp;首页 上一页&nbsp;"
  	else
    		response.write ""&totalnumber&"个&nbsp;<a href="&filename&"?page=1&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">首页</a>&nbsp;"
    		response.write "<a href="&filename&"?page="&CurrentPage-1&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		response.write "下一页 尾页"
  	else
    		response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">"
    		response.write "下一页</a> <a href="&filename&"?page="&n&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">尾页</a>"
  	end if
   	response.write "&nbsp;页次：<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
    	response.write "&nbsp;<b>"&maxperpage&"</b>个软件/页 "
%>
转到：<select name='page' size='1' style='background-color:#ffffFF' onchange='javascript:submit()'>   
              <%for i = 1 to n%>   
              <option value='<%=i%>' <%if cint(Page)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>   
              <%next%>   
            </select>
 </form>  
 
<%                   
end function
%>

<p align=center><!--#include file=down_query.asp-->

      </td>                           
    </tr>                           
</table>                           
  
<%
Dvbbs.footer()
%>







