% option explicit %> <% dim sort,key,str,color color=1 sort=request("sort") key=trim(request("key")) if sort<>"topic" and sort<>"content" then sort="topic" end if dim curpage,i,page dim rs,sql if session("purview")>"99997" then '管理员和审核员可以列出全部文章 if key="" then '如果搜索关键词为空则列出全部文章 set rs=server.createobject("adodb.recordset") rs.open "select * from news order by ntime DESC",conn,1,1 str="列出全部文章" else if sort="topic" then '按文章标题查找 set rs=server.createobject("adodb.recordset") rs.open "select * from news where topic like '%" & key & "%' order by ntime DESC",conn,1,1 str="按文章标题查找" end if if sort="content" then '按文章标题查找 set rs=server.createobject("adodb.recordset") rs.open "select * from news where content like '%" & key & "%' order by ntime DESC",conn,1,1 str="按文章内容查找" end if end if else '一般用户只能列出通过审核的文章 if key="" then '如果搜索关键词为空则列出全部文章 set rs=server.createobject("adodb.recordset") rs.open "select * from news where audit=1 order by ntime DESC",conn,1,1 str="列出全部文章" else if sort="topic" then '按文章标题查找 set rs=server.createobject("adodb.recordset") rs.open "select * from news where audit=1 and topic like '%" & key & "%' order by ntime DESC",conn,1,1 str="按文章标题查找" end if if sort="content" then '按文章标题查找 set rs=server.createobject("adodb.recordset") rs.open "select * from news where audit=1 and content like '%" & key & "%' order by ntime DESC",conn,1,1 str="按文章内容查找" end if end if end if 'if session("purview")>"99997" if err.number <> 0 then response.write "数据库出错" else %>
查询类型: <%=str%><% if key<>"" then
response.write "    查询关键字: " & key & ""
end if %>    查询结果:共有 <%=rs.recordcount%> 条文章符合查询条件 |
---------- 文 章 标 题 ---------- |
----- 加 入 时 间 ----- |
浏览次数 |
| ">" target=_blank><%=trim(rs("topic"))%> | "> <%=rs("ntime")%> |
"> <%=rs("hits")%> |