📄 search.asp
字号:
<!-- #include file="conn.asp" -->
<html>
<head>
<link href=css.css rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>中国人民大学二手交易网-搜索结果</title></head>
<body>
<div align="center">
<!-- #include file="head.asp" -->
<!-- #include file="menu.asp" -->
<!-- #include file="function.asp" -->
<%
action=request.QueryString("action")
if action="keyword" then
kind=ReplaceBadChar(request("search_kind"))
keyword2=ReplaceBadChar(request("keyword"))
search_op=ReplaceBadChar(request("search_op"))
keyword=Split(Trim(keyword2))
sql="select * from info where info_kind='"&kind&"' and info_status='有效'"
if search_op="title" then
sql=sql+" and info_title like '%"
For i = 0 To UBound(keyword)
sql = sql + keyword(i)
If i = UBound(keyword) Then
sql = sql + "%'"
Else
sql = sql + "%' and info_title like '%"
End If
Next
elseif search_op="intro" then
sql=sql+" and info_intro like '%"
For i = 0 To UBound(keyword)
sql = sql + keyword(i)
If i = UBound(keyword) Then
sql = sql + "%'"
Else
sql = sql + "%' and info_intro like '%"
End If
Next
end if
sql=sql+" order by info_id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
elseif action="price_op" then
price_op=request("price_op")
if price_op=1 then
sql="select * from info where info_kind='供' and info_status='有效' and info_price<=10"
elseif price_op=2 then
sql="select * from info where info_kind='供' and info_status='有效' and info_price<=30 and info_price>10"
elseif price_op=3 then
sql="select * from info where info_kind='供' and info_status='有效' and info_price<=50 and info_price>30"
elseif price_op=4 then
sql="select * from info where info_kind='供' and info_status='有效' and info_price<=100 and info_price>50"
elseif price_op=5 then
sql="select * from info where info_kind='供' and info_status='有效' and info_price>100"
end if
sql=sql+" order by info_id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
elseif action="user_op" then
uname=ReplaceBadChar(request("uname"))
sql="select * from info where info_status='有效' and info_user='"&uname&"' order by info_id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
elseif action="av_search" then
kind=request("search_kind")
keyword2=ReplaceBadChar(request("keyword"))
search_op=request("search_op")
price_op=request("price_op")
class2=request("class")
keyword=Split(Trim(keyword2))
sql="select * from info where info_kind='"&kind&"' and info_status='有效' and info_bclass="&class2&""
if search_op="title" then
sql=sql+" and info_title like '%"
For i = 0 To UBound(keyword)
sql = sql + keyword(i)
If i = UBound(keyword) Then
sql = sql + "%'"
Else
sql = sql + "%' and info_title like '%"
End If
Next
elseif search_op="intro" then
sql=sql+" and info_intro like '%"
For i = 0 To UBound(keyword)
sql = sql + keyword(i)
If i = UBound(keyword) Then
sql = sql + "%'"
Else
sql = sql + "%' and info_intro like '%"
End If
Next
end if
if price_op=1 then
sql=sql+" and info_price<=10"
elseif price_op=2 then
sql=sql+" and info_price>10"
elseif price_op=3 then
sql=sql+" and info_price<=50 and info_price>30"
elseif price_op=4 then
sql=sql+" and info_price<=100 and info_price>50"
elseif price_op=5 then
sql=sql+" and info_price>100"
end if
sql=sql+" order by info_id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
end if
%>
<table width="760" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="95" height="48"> </td>
<td width="557" valign="top"><p> </p>
<p></p></td>
<td width="108"> </td>
</tr>
<tr>
<td height="126"> </td>
<td valign="top"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#66CCFF">
<!--DWLayoutTable-->
<tr>
<td height="24" colspan="4" valign="middle" bgcolor="#00FFFF"> <div align="center"><strong>搜索结果</strong></div></td>
</tr>
<tr>
<td height="23" colspan="4" valign="top" bgcolor="#FFFFFF">
<%if rs.eof then response.Write("没有找到您要的结果!")%>
</td>
</tr>
<tr>
<td width="334" height="20" align="center" valign="middle" bgcolor="#FFFFFF"><strong>标题(点击察看详细)</strong></td>
<td width="79" align="center" valign="middle" bgcolor="#FFFFFF"><strong>剩余有效天数</strong></td>
<td width="71" align="center" valign="middle" bgcolor="#FFFFFF"><strong>发布人</strong></td>
<td width="60" align="center" valign="middle" bgcolor="#FFFFFF"><strong>价格</strong></td>
</tr>
<%
if not rs.eof then
page=request.querystring("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)
rs.pagesize=25
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
rs.cachesize=rs.pagesize
end if
i=0
do while not rs.eof and (i<rs.pagesize)
i=i+1
%>
<tr>
<td width="334" height="20" valign="top" bgcolor="#FFFFFF"><%if rs("info_kind")="供" then%>[<font color="#FF0000">供</font>]<%else%>[<font color="#0000FF">求</font>]<%end if%><a href="showinfo.asp?id=<%=rs("info_id")%>"><%=gotTopic(rs("info_title"),30)%></a>
</td>
<td width="79" align="center" valign="middle" bgcolor="#FFFFFF"><%=rs("info_expiredays")-datediff("d",rs("info_date"),date())%></td>
<td width="71" align="center" valign="middle" bgcolor="#FFFFFF"><a href=p_write.asp?action=reply&sender=<%=rs("info_user")%>><%=rs("info_user")%></a></td>
<td width="60" align="center" valign="middle" bgcolor="#FFFFFF"><%=rs("info_price")%></td>
</tr>
<%rs.movenext
loop
rs.close
%>
<tr>
<td height="28" colspan="4" valign="top" bgcolor="#FFFFFF"><div align="right">第 <%=page%> 页 共 <%=totalpage%>
页 <%if page>1 then%><a href="search.asp<%if action="keyword" then response.write "?action=keyword&search_kind="+kind+"&keyword="+keyword2+"&search_op="+search_op end if
if action="av_search" then response.write "?action=av_search&search_kind="+kind+"&keyword="+keyword2+"&search_op="+search_op+"&price_op="+price_op+"&class="+class2 end if
if action="price_op" then response.write "?action=price_op&price_op="+price_op end if
if action="user_op" then response.write "?action=user_op&uname="+uname end if%>&page=<%=page-1%>">上一页</a><%end if%> <%if page<totalpage then%><a href="search.asp<%if action="keyword" then response.write "?action=keyword&search_kind="+kind+"&keyword="+keyword2+"&search_op="+search_op end if
if action="av_search" then response.write "?action=av_search&search_kind="+kind+"&keyword="+keyword2+"&search_op="+search_op+"&price_op="+price_op+"&class="+class2 end if
if action="price_op" then response.write "?action=price_op&price_op="+price_op end if
if action="user_op" then response.write "?action=user_op&uname="+uname end if%>&page=<%=page+1%>">下一页</a><%end if%></div></td>
</tr>
<tr>
<td height="28" colspan="4" valign="top" bgcolor="#00FFFF"><p>说明:<br>
1.搜索结果全部为有效结果,按照发布日期排序<br>
2.点击发布人可以给发布人留言,但您需要是本站用户并登陆<br>
3.剩余有效天数若出现负数,表明该信息已过,不久将被系统删除<br>
</p></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="78"> </td>
<td> </td>
<td> </td>
</tr>
</table>
<!-- #include file="foot.asp" -->
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -