<!--#include file="conn.asp"-->
<!--#include file="./inc/head.asp"-->
<!--#include file="./inc/const.asp"-->
<!--#include file="./inc/char.asp"-->
<table width="100%" border="0" cellspacing="3" cellpadding="3"><tr><td height="20">当前位置:<a href=main.asp>管理首页</a> >> <a href=search.asp>文章搜索</a></td></tr></table>
<%if request("keyword")="" then%>
<script language=javascript>
alert( "错误:请输入关键字!" );
location.href = "javascript:history.back()"
</script>
<%else%>
<table width="95%" cellspacing="1" cellpadding="5" bgcolor="#999999" align="center">
<tr bgcolor=#cccccc><td colspan=8><center><b>搜索 <font color=red><%=request("keyword")%></font> 结果</td></tr>
<tr bgcolor=#ffffff><td height=25 colspan=8></td></tr>
<tr bgcolor=#ffcc00 align=center><td width=2%></td><td width=48%><b>文章标题</td><td width=12%><b>发表时间</td><td width=8%><b>作 者</td><td width=5%><b>头条</td><td width=5%><b>焦点</td><td width=5%><b>图片</td><td width=15%><b>操作</td></tr>
<%
keyword=trim(request("keyword"))
dim searchday
if request("DateSearch")="all" then
searchDay=""
else
searchDay=" DATEDIFF('d',addtime,Now()) < "&request("DateSearch")&" and "
end if
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
set rs = server.CreateObject ("Adodb.recordset")
if request("AreaSearch")=1 then
sql="select * from article where "& searchday &" (" & translate(keyword,"title") & ") order by id desc"
elseif request("AreaSearch")=2 then
sql="select * from article where "& searchday &" (" & translate(keyword,"content") & ") order by id desc"
end if
rs.open sql,conn,1,1
recordcount = RS.RecordCount
RS.PageSize = PAGESIZE
pagecount = RS.PageCount
if page < 1 then
page = 1
elseif page > pagecount then
page = pagecount
end if
if RS.EOF then
Response.Write("<tr bgcolor=#ffffff><td colspan=8 height=20><center><br><font color=red>没有搜索到任何结果!</font></td></tr>")
else
if recordcount > 0 then RS.AbsolutePage = page
for i = 1 to PAGESIZE
if RS.EOF then exit for
%>
<tr bgcolor=#eeeeee>
<td bgcolor=#ffffff><img src=./img/folder.gif></td>
<td><a class=list href=../html/<%=rs("fpath")%>/<%=rs("fname")%> target=_blank><%=HTMLencode(rs("title"))%></a> <font color=#666666>(<%=len(rs("content"))%>字节)</td>
<td><center><%=rs("addtime")%></td>
<td><center><a href=admin_userinfo.asp?username=<%=rs("username")%>><%=rs("username")%></a></td>
<td bgcolor=#dddddd><center><%if session("userkey")=4 then %><%if rs("ifhead")=1 then%><a href=admin_article.asp?action=headno&id=<%=rs("id")%>><font color=red>是</font></a><%else%><a href=admin_article.asp?action=headyes&id=<%=rs("id")%>>否</a><%end if%><%else%><%if rs("ifhead")=1 then%><font color=red>是</font><%else%>否<%end if%><%end if%></td>
<td><center><%if session("userkey")=4 then %><%if rs("ifgood")=1 then%><a href=admin_article.asp?action=goodno&id=<%=rs("id")%>><font color=blue>是</font></a><%else%><a href=admin_article.asp?action=goodyes&id=<%=rs("id")%>>否</a><%end if%><%else%><%if rs("ifgood")=1 then%><font color=blue>是</font><%else%>否<%end if%><%end if%></td>
<td bgcolor=#dddddd><center><%if session("userkey")=4 then %><%if rs("ifimg")=1 then%><a href=admin_article.asp?action=imgno&id=<%=rs("id")%>><font color=green>是</font></a><%else%><a href=admin_article.asp?action=imgyes&id=<%=rs("id")%>>否</a><%end if%><%else%><%if rs("ifimg")=1 then%><font color=red>是</font><%else%>否<%end if%><%end if%></td>
<td><center><%if session("userkey")=4 then %><%if rs("ifshow")=1 then%><a href=admin_article.asp?action=showno&id=<%=rs("id")%>><font color=red>已审</font></a><%else%><a href=admin_article.asp?action=showyes&id=<%=rs("id")%>>待审</a><%end if%><%else%><%if rs("ifshow")=1 then%><font color=red>已审</font><%else%>待审<%end if%><%end if%>
<%if session("userkey")=4 or session("username")=rs("username") then%> | <a href=fastedit.asp?id=<%=rs("id")%>><font color=green>修改</font></a><%end if%>
<%if session("userkey")=4 or session("username")=rs("username") then%> | <a href=admin_article.asp?action=delarticle&id=<%=rs("id")%>><font color=blue>删除</font></a><%end if%></td>
</tr>
<%
RS.MoveNext()
next
end if
%>
</table>
<%
if pagecount > 0 then
response.write("<table width=""95%"" align=center cellspacing=3 cellpadding=3><tr><td align=right>")
response.write("页次:<font color=red><b>" & page & "</font>/" & pagecount & "</b> 每页<b>" & pagesize & "</b> 共<b>" & recordcount & "</b>篇文章 分页:")
Spage = page mod PARTSIZE
if page > PARTSIZE then
if Spage = 0 then Spage = PARTSIZE
Spage = page - Spage + 1
else
Spage = 1
end if
Epage = Spage + PARTSIZE - 1
if Epage > pagecount then Epage = pagecount
if page > PARTSIZE then
response.write("<a href=""searchresult.asp?page=" & Spage - 1 & """>[<<]</a>")
end if
for i = Spage to Epage
if i = page then
response.write("[<font color=red><b>" & i & "</b></font>]")
else
response.write("[<a href=""searchresult.asp?page=" & i & """>" & i & "</a>]")
end if
next
if Epage < pagecount then
response.write("<a href=""searchresult.asp?page=" & Epage + 1 & """>[>>]</a>")
end if
if Spage <> 1 then response.write("[<a href=""searchresult.asp?page=1"">首页</a>]")
if Epage <> pagecount then response.write("[<a href=""searchresult.asp?page=" & pagecount & """>尾页</a>]")
response.write("</td></tr></table><br>")
end if
rs.close
set rs=nothing
%>
<%end if%>
<!--#include file="./inc/end.asp"-->
上面代码,翻页总是提示,请输入关键字?
请问如何解决呢。。
[此贴子已经被作者于2006-12-18 14:56:15编辑过]