<%
if request.querystring("cat_id") <>"" then 
  if not isInteger(request.querystring("cat_id")) then
    Response.Write "<script language=javascript>alert('参数非法');javascript:history.back();</script>"
    Response.End
  end if
end if
if request.querystring("gqclass")<>"" then
  if not isInteger(request.querystring("gqclass")) then
    Response.Write "<script language=javascript>alert('参数非法');javascript:history.back();</script>"
    Response.End
  end if
end if
if request("page")<>"" then
  if not isInteger(request("page")) then
    Response.Write "<script language=javascript>alert('参数非法');javascript:history.back();</script>"
    Response.End
  end if
end if
if request("keyword")<>"" then
  if instr(request("keyword"),"'")>0 then
    Response.Write "<script language=javascript>alert('搜索参数非法');javascript:history.back();</script>"
    Response.End
  end if
end if

'=================================================
'过程名：main_gq
'作  用：显示供求位置导航
'参  数：无
'=================================================
sub main_gq()
  Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> ->> <a href='fillbuy.asp'>供求信息</a>" & vbCrLf
%>
<%if request.querystring("cat_id")="" and request.querystring("gqclass")="" then%>  <font color=#FF6600>→</font> 信息列表<%else%>
<%if request.querystring("gqclass")<>"" then%>
<%sql="select * from gqclass where gqclass_id="&request.querystring("gqclass")
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
%> ->> <a href=Fillbuy.asp?gqclass=<%=request.querystring("gqclass")%>><%=rs2("gqclass_name")%></a> <%end if%>
<%if request.querystring("cat_id")<>"" then%>
<%sql="select * from gqcat where gqcat_id="&request.querystring("cat_id")
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
%> ->> <a href=Fillbuy.asp?cat_id=<%=request.querystring("cat_id")%>><%=rs2("gqcat_name")%></a> 　<%end if%><%end if
end sub
'=================================================
'过程名：xinxi_gq
'作  用：显示供求信息分类
'参  数：无
'=================================================
sub xinxi_gq()
%>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" id="table5"><tr>
<%sql="select * from gqcat"
set rs0=server.createobject("adodb.recordset")
rs0.open sql,conn,1,1
i=0
do while not rs0.eof
i=i+1
%>
<td width="50%" height="22">&nbsp;&nbsp;&nbsp;<a href="Fillbuy.asp?gqclass=<%=request.querystring("gqclass")%>&cat_id=<%=rs0("gqcat_id")%>"><%=rs0("gqcat_name")%></a></td>
<%if i mod 2 =0 then%>
</tr><tr>
<%
end if
rs0.movenext
loop
if rs0.eof and rs0.bof then%>
<tr><td>
	<p align="center">当前没有分类</td></tr>
<%end if%>
</tr><tr>
<td height="5"></td>
</tr>
</table>
<%end sub
'=================================================
'过程名：leixing_gq
'作  用：显示供求类型
'参  数：无
'=================================================
sub leixing_gq()%>
<table border="0" style="border-collapse: collapse" width="100%" cellpadding="0" id="table6">
  <tr>
<%sql="select * from gqclass"
set rs0=server.createobject("adodb.recordset")
rs0.open sql,conn,1,1
i=0
do while not rs0.eof
i=i+1
%>
<td width="50%" height="22">&nbsp;&nbsp;&nbsp;<a href="Fillbuy.asp?gqclass=<%=rs0("gqclass_id")%>&cat_id=<%=request.querystring("cat_id")%>"><%=rs0("gqclass_name")%></a></td>
<%if i mod 2 =0 then%>
</tr><tr>
<%
end if
rs0.movenext
loop
if rs0.eof and rs0.bof then%>
<tr><td>
	<p align="center">当前没有分类</td></tr>
<%end if%></tr></table>
<%end sub
'=================================================
'过程名：search_gq
'作  用：显示供求搜索
'参  数：无
'=================================================
sub search_gq()
%>	
<form name='form2' method='post' action='Fillbuy.asp'><div align=center><input type='radio' name='select' value='gq_name' checked class='inuptCG'>主题&nbsp;<input type='radio' name='select' value='Content' class='inuptCG'>内容&nbsp;<input type='radio' name='select' value='review' class='inuptCG'>评论<input type='text' name='keyword'  size='15' value='搜索关键字' maxlength='50' onfocus="this.value=''" class='input'>&nbsp;<input type='submit' name='search'  value='搜索' onmouseover="this.className='boton'" onmouseout="this.className='botoff'"></div></form>
<%end sub
'=================================================
'过程名：display_gq
'作  用：显示供求列表
'参  数：无
'=================================================
sub display_gq()
dim totalgq,Currentpage,totalpages,i
sql="select * from gq where passed=0 order by istop desc,gq_id DESC"
if request.querystring("cat_id")<>"" and request.querystring("gqclass")<>"" then
sql="select * from gq where gqcat_id="&request.querystring("cat_id")&" and InfoClass="&request.querystring("gqclass")&" and passed=0 order by istop desc,gq_id DESC"
elseif request.querystring("cat_id")<>"" then
sql="select * from gq where gqcat_id="&request.querystring("cat_id")&"  and passed=0 order by istop desc,gq_id DESC"
elseif request.querystring("gqclass")<>"" then
sql="select * from gq where InfoClass="&request.querystring("gqclass")&" and passed=0 order by istop desc,gq_id DESC"
elseif request("keyword")<>"" and (request("select")="gq_name" or request("select")="gq_desc" or request("select")="review") then
sql="select * from gq where "&request("select")&" like '%"&Jencode(request("keyword"))&"%' and passed=0 order by istop desc,gq_id DESC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
totalgq=rs.recordcount
%>

<table width="99%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" bordercolor='#f0f0f0' style="border-collapse: collapse" align="right" frame=lhs>
<TR bgColor=#FFFFFF><TD width="100%" align=Center height="26" colspan="6">
	<p align="left"><font color="#b70000"><b>&nbsp; ·</b></font>&nbsp;&nbsp; <%if request("cat_id")<> "" then%>本分类共有<%elseif request("keyword")<>"" then%>共搜索到<%else%>当前共有<%end if%><span><%=totalgq%></span>个信息  
       <%sql="select gq_id from gq where passed=1"
  set rs1=server.createobject("adodb.recordset")
  rs1.open sql,conn,1,1
  shgqcount=rs1.recordcount%>待审核<span><%=shgqcount%></SPAN>个　</TD>
	</TR>
<TR bgColor=#FFFFFF><TD width="4%" align=Center height="26">状态</TD>
	<TD width="11%" align=Center height="26">类型</TD>
	<TD width="45%" align=Center>
	信息主题</TD><TD width="15%" align=Center>地区</TD><TD width="9%" align=Center>人气</TD>
	<TD align="center" width="16%">发表时间</TD></TR>
<%gqperpage=30
if not rs.eof then
rs.movefirst
rs.pagesize=gqperpage
if trim(request("page"))<>"" then
   currentpage=clng(request("page"))
   if currentpage>rs.pagecount then
      currentpage=rs.pagecount
   end if
else
   currentpage=1
end if
   if currentpage<>1 then
       if (currentpage-1)*gqperpage<totalgq then
	       rs.move(currentpage-1)*gqperpage
		   dim bookmark
		   bookmark=rs.bookmark
	   end if
   end if
   if (totalgq mod gqperpage)=0 then
      totalpages=totalgq\gqperpage
   else
      totalpages=totalgq\gqperpage+1
   end if
i=0
do while not rs.eof and i<gqperpage
%>
<%    
if rs("istop")="1" then      
folder="<img src=""img/1.gif"" title=固顶信息>"       
else
folder="<img src=""img/4.gif"" title=普通信息>"       
end if      
if rs("istop")="0" then      
if rs("isbest")=1 then
folder="<img src=""img/2.gif"" title=推荐信息>"
elseif rs("gq_count")>=popgqnum then
folder="<img src=""img/3.gif"" title=热门信息>"      
else
folder="<img src=""img/4.gif"" title=普通信息>"       
end if      
end if      
%> 
<TR bgColor=#FFFFFF><TD width="4%" align=Center height="26"><%=folder%></TD>
	<TD width="11%" align=Center height="26"><%sql="select * from gqclass where gqclass_id="&rs("infoclass")
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
sql="select * from area where cat_id="&rs("sheng")
set rs001=server.createobject("adodb.recordset")
rs001.open sql,conn,1,1
sql="select * from area where cat_id="&rs("city")
set rs002=server.createobject("adodb.recordset")
rs002.open sql,conn,1,1
%> 
<b>［<%=left(rs2("gqclass_name"),2)%>］</TD><TD width="45%">&nbsp;<a href='showgq.asp?gq_id=<%=rs("gq_id")%>' Title='信息名称：<%=rs("gq_name")%>&#13&#10查看次数：<%=rs("gq_count")%>&#13&#10上传时间：<%=rs("gq_date")%>'><%=rs("gq_name")%></a></TD>
	<TD width="15%" align=Center><%if rs("sheng")=0 then%>全国<%else%><%=rs001("cat_name")%><%=rs002("cat_name")%><%end if%></TD>
	<TD width="9%" align=Center><%=rs("gq_count")%></TD>
	<TD align="center" width="16%"><%=formatdatetime(rs("gq_date"),2)%></TD></TR>
<%
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then%><tr><td align=middle height="60" colSpan=6><%if request("cat_id")<> "" then%>该分类暂时没有信息<%elseif request("keyword")<>"" then%>没有找到包含[<b><font color=red><%=request("keyword")%></font></b>]的信息！<%else%>没有任何信息
	！<%end if%></td></td></tr>
<%end if
end if
%>
<form name="form1" method="post" action="fillbuy.asp?select=<%=request("select")%>&keyword=<%=request("keyword")%>&cat_id=<%=request.querystring("cat_id")%>">
<tr> 
<td align="right" colspan="6">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR> 
<TD align=middle width="35%" height=25><IMG height=14 src="img/so.gif" width=14 align=absMiddle> 共[<font color="#FF6666"><%=totalgq%></font>]个信息　分[<font color="#FF6666"><%=totalpages%></font>]页</TD>
<TD width="40%" align=middle><IMG height=11 src="img/lt.gif" width=11 align=absMiddle>
<%
if CurrentPage<2 then
response.write "<font color='999966'>首页 上一页</font> "
else
response.write "<a href=fillbuy.asp?select="&request("select")&"&keyword="&request("keyword")&"&page=1&gqcat_id="&request.querystring("gqcat_id")&">首页</a> "
response.write "<a href=fillbuy.asp?select="&request("select")&"&keyword="&request("keyword")&"&page="&CurrentPage-1&"&gqcat_id="&request.querystring("gqcat_id")&">上一页</a> "
end if
if totalpages-currentpage<1 then
response.write "<font color='999966'>下一页 尾页</font>"
else
response.write "<a href=fillbuy.asp?select="&request("select")&"&keyword="&request("keyword")&"&page="&CurrentPage+1&"&gqcat_id="&request.querystring("gqcat_id")
response.write ">下一页</a> <a href=fillbuy.asp?select="&request("select")&"&keyword="&request("keyword")&"&page="&totalpages&"&gqcat_id="&request.querystring("gqcat_id")&">尾页</a>"
end if
%>&nbsp;<IMG height=11 src="img/rt.gif" width=11 align=absMiddle></TD>
<TD align=middle width="25%">
<select name="page" >
<%
i=1
for i=1 to totalpages
if i=currentpage then
%>
<option value=<%=i%> selected>第<%=i%>页</option> 
<%else%>
<option value=<%=i%>>第<%=i%>页</option> 
<%end if
next%>
</select><input type="submit" name="Submit2" value="转向" onmouseover="this.className='boton'" onmouseout="this.className='botoff'" class="botoff"> </TD>
</TR>
</FORM>
</TABLE> </td></tr>
<tr align="center"><td height="1" colspan="6"></td></tr></table>
<%end sub
%>