    <!-- #include file="conn.asp" -->
<html>
<head>
<title>武汉家教网（学员信息列表）-我要找家教工作！</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0><div align="center">
    <TABLE WIDTH=778 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="FBFCED">
              <TR>
                <TD align="center"><table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="center"><table width="90%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#000063">
                        <form name="form1" method="post" action="">
                          <tr align="center" bgcolor="#FFFFDD">
                            <td bgcolor="#FEF49C">搜索</td>
                            <td bgcolor="#FFFFDD"><input name="key" type="text" value="<%=request("key")%>" size="40"></td>
                            <td bgcolor="#FFFFDD"><select name="types">
                                <option value="">不限</option>
								<option value="消费导购">消费导购</option> 
                                <option value="新闻热点">新闻热点</option>
								<option value="硬件评测">硬件评测</option>
								<option value="电脑维护">电脑维护</option>
                            </select></td>
                            <td bgcolor="#FFFFDD"><input name="Submit" type="submit" class="input2" value="提交"></td>
                          </tr>
                        </form>
                    </table></td>
                  </tr>
                </table>                  
<table width="90%"  border="0" cellpadding="3" cellspacing="1" bgcolor="#000066">
<Form name="searchid" method="POST" action="">
<tr align="center" bgcolor="#FFCC33">
                      <td width="6%">编号</td>
                      <td width="40%">新闻标题</td>
                      <td width="15%">类别</td>
                      <td width="6%">图片</td>
                      <td width="14%">发布日期</td>
					  <td width="11%">修改</td>
					  <td width="8%"><input type='submit' value='删除'></td>
</tr>
                  <%
page=request.querystring("page")
key=request.form("key")
types=request.form("types")
DIM totalPut
DIM CurrentPage
DIM TotalPages
DIM i,j
const MaxPerPage=20
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
dim rs
dim sql
set rs=server.createobject("adodb.recordset")
sql = "select * from news where news_id like '%'"
if not types="" then
sql=sql & " and types='"&types&"'" 
end if
if not key="" then
sql=sql & " and news_title & news_content like '%" & key & "%'"
end if
sql=sql & " order by news_id desc"
rs.open sql,conn,1,1 
if rs.eof and rs.bof then 
response.write "<p align='center'>对不起，没有您要查询的[ <font style='font-weight:bold;color:red'>"&sql&"</font> ]的信息</p>" 
else 
totalPut=rs.recordcount 
if currentpage<1 then 
currentpage=1 
end if 
if (currentpage-1)*MaxPerPage>totalput then 
if (totalPut mod MaxPerPage)=0 then 
currentpage= totalPut \ MaxPerPage 
else 
currentpage= totalPut \ MaxPerPage + 1 
end if 
end if 
if currentPage=1 then 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"news.asp"
else 
if (currentPage-1)*MaxPerPage<totalPut then 
rs.move (currentPage-1)*MaxPerPage 
dim bookmark 
bookmark=rs.bookmark 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"news.asp"
else 
currentPage=1 
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"news.asp"
end if 
end if 
rs.close 
end if 
set rs=nothing
sub showContent (totalput,MaxPerPage)
do while not rs.eof
%>

                    <tr class="hand" align="center" bgcolor="#FDFEF5" onmouseover="this.style.backgroundColor='eff7ff'" onmouseout="this.style.backgroundColor='#FDFEF5'">
                      <td><%=rs("news_id")%></td>
                      <td><a href="news_info.asp?id=<%=rs("news_id")%>"><%=Replace(rs("news_title"),key,"<font style='font-weight:bold;color:red'>"&key&"</font>")%></a></td>
                      <td><%=rs("types")%></td>
                      <td><%if rs("pic")="-" then
					  Response.Write("-")
					  else
					  Response.Write("√")
					  end if
					  %></td>
                      <td><%=int(rs("idate"))%></td>
					  <td>修改 更新</td>
					  <td><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("news_ID"))%>'></td>
                    </tr>                    
                  <% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</form>
</table>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then 
n= totalnumber \ maxperpage 
else 
n= totalnumber \ maxperpage+1 
end if 
if CurrentPage<2 then 
response.write "<table border=0 width=80% cellspacing=0 cellpadding=0>" 
response.write "<tr height=50>"
response.write "<td>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>" 
response.write "<td align=right>"
response.write "【最前页】【上一页】" 
else 
response.write "<table border=0 width=90% cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条信息</td>"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&types="&types&"&key="&key&">最前页</a>】" 
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&types="&types&"&key="&key&">上一页</a>】" 
end if 
if n-currentpage<1 then 
response.write "【下一页】【最后页】" 
else 
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&types="&types&"&key="&key&">" 
response.write "下一页</a>】【<a href="&filename&"?page="&n&"&types="&types&"&key="&key&">最后页</a>】" 
end if 
response.write "</td>"
response.write "</tr>"
response.write "</table>"
end function
%></TD>
              </TR>
  </TABLE>
  </div>
</body>
</html>
<%
sub deleteannounce(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="delete from [news] where news_id="&cstr(id)
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub
%>