<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="setup.asp"-->
<!--#include file="conn.asp"-->
<%
'以下代码可以放到 第65行**********************************
if request("page")="" then
curpage = 1
else
curpage = cint(getsaferequest(request.QueryString("page")))
end if
'以上代码可以放到 第65行**********************************
sort=Get_SafeStr(request.Form("sort"))
key=Get_SafeStr(request.Form("key"))
if sort<>"topic" and sort<>"content" then
    sort="topic" 
end if

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=site_name%></title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body><!--#include file="top.asp"-->
<%
sql="select * from news order by id DESC"
if key="" then       '如果搜索关键词为空则列出全部文章
    sql= "select * from news order by id DESC"
	str="列出全部文章"
else
    if sort="topic" then     '按文章标题查找
        sql="select * from news where title like '%" & key & "%' order by id DESC"
		str="按文章标题查找"
    end if
	if sort="content" then     '按文章标题查找
        sql="select * from news where content like '%" & key & "%' order by id DESC"
		str="按文章内容查找"
    end if
end if%>
<div id="box">
<div id="left">
<div id="nav4">点击排行</div>
<div id="nav_content">
<ul>
<%
 Set rs = Server.CreateObject("ADODB.RecordSet")
rs.open "select top 6 * from news order by hit desc",conn,1,1
if rs.eof and rs.bof then
response.Write("")
else
do while not rs.eof
%>
<li>·<a href="list.asp?yiid=<%=rs("yiid")%>"><%=rs("title")%></a></li>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
 %>
</ul>
</div>

</div>

<div id="right">
<div id="address">您的位置：本站首页→ <span class="style3">搜索(<%=str%>)</span></div>

<div id="big_content">
<div id="content">
<%
set rs=server.createobject("ADODB.recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write "暂无相关信息"
else
number=san_lanmu_no  '设置每页显示条数
'本页代码顶部的那里有一个说明说代码可以移植到此处
rs.pagesize=cint(number)
rs.absolutepage = curpage

for i= 1 to rs.pagesize
response.Write "<table width='98%'cellSpacing=0 cellPadding=0 border=0 style='line-height:140% '><tr><td width='15'><img src='img/icon.gif'></td><td style='border-bottom: 1px dotted #cccccc' width='500'><a href='show.asp?id=" & rs("id") & "' target='_blank'  title='"& rs("title") & "  [" & rs("newstime")& "]" & "'>"
'rs("title")
if len(trim(rs("title")))<=15 then
					    response.write left(trim(rs("title")),18)
						else
						response.write left(trim(rs("title")),18) & "…"
end if
if date()<rs("newstime")+2 then
						response.write  "<img src='img/news2.gif' border=0>"
end if
response.write "</a></td><td style='border-bottom: 1px dotted #cccccc'>["&gettime(rs("newstime"))&"]</td></tr></table>"

rs.movenext
if rs.eof then
           i=i+1
           exit for
       end if
next
%>
</div>
<%     response.Write "页次<b>"&curpage&"/"&rs.pagecount&"</b>--每页<b>"&number&"</b>--共<b>"&rs.recordcount&"</b>条&nbsp;&nbsp;&nbsp;"
     if curpage = 1 then 
		response.write "<font face='Webdings'>9</font> <font face='Webdings'>7</font> "
	else
		if er="ok" then response.write "<a class='xiahua' href='?page=1'><font face='Webdings'>9</font></a> <a class='xiahua' href='?page=" & cstr(curpage-1) & "'><font face='Webdings'>7</font></a> " else response.write "<a class='xiahua' href='?page=1'><font face='Webdings'>9</font></a> <a class='xiahua' href='?page=" & cstr(curpage-1) & "'><font face='Webdings'>7</font></a> " end if
	end if
	if  curpage = rs.pagecount then
		response.write "<font face='Webdings'>8</font> <font face='Webdings'>:</font>"
	else
	    if er="ok"	then response.write "<a class='xiahua' href='?page=" & cstr(curpage+1) & "'><font face='Webdings'>8</font></a> <a class='xiahua' href='?page=" & cstr(rs.pagecount) & "'><font face='Webdings'>:</font></a>" else response.write "<a class='xiahua' href='?page=" & cstr(curpage+1) & "'><font face='Webdings'>8</font></a> <a class='xiahua' href='?page=" & cstr(rs.pagecount) & "'><font face='Webdings'>:</font></a>" end if
	end if
	response.write "(总共"&rs.recordcount&"条新闻)"
''''''''设置上一页,下一页功能////////////////////////////////////////////////////////////////////////////////////
end if
%>
</div>
</div>
</div>
<!--#include file="bottom.asp"-->
<%

rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
