<%if session("admin")="" then
response.write"你没有登录或是非法用户!<meta http-equiv=refresh content='1;url=../index.asp'>"
response.End()
end if%>
<!--#include file=conn.asp-->
<!--#include file="../config.asp"-->
<head>
<link href=../iknow.css rel=stylesheet type=text/css>
</head>
<table width="95%"  border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF" height="109">
  <%if request("gai2")="修改" then
  if request("title")="" then
  response.write"<tr><td bgcolor=ffffff colspan=7>公告标题不能为空!<a href=javascript:history.back()>返回</a></td></tr>"
  response.End()
  elseif request("text")="" then
  response.write"<tr><td bgcolor=ffffff colspan=7>公告内容不能为空!<a href=javascript:history.back()>返回</a></td></tr>"
  response.End()
  else
  rs.open"select * from gonggao where id="&cint(request("id")),conn,1,3
  rs("title")=request("title")
  rs("text")=request("text")
  rs.update
  rs.close
  response.write"<tr><td bgcolor=ffffff colspan=7>公告修改成功!</td></tr><meta http-equiv=refresh content='1;url=admingaog.asp'>"
  response.End()
  end if
  end if%>
  <%if request("gai")="修改" then
  rs.open"select * from gonggao where id="&cint(request("id")),conn,1,1%>
  <form method=post action=admingaog.asp?id=<%=cint(request("id"))%>><tr><td bgcolor=ffffff colspan="7">标题:                                          
    <input name="title" type="text" id="title" size="37" value=<%=rs("title")%>><br>内容:<br>
    <textarea name="text" cols="66" rows="10" id="content"><%=rs("text")%></textarea><br><br>
    <input name="gai2" type="submit" id="gai2" value="修改">
    <input name="reset" type="reset" id="reset" value="重写">                                          
	</td></tr></form>
	<%rs.close
	response.End()
	end if%>
  <tr>
    <td height="23" colspan="6" align="center" bgcolor="#EEEEEE"><font style="font-size:14px">管理公告</font></td>
  </tr>
  <%if request("del")="删除" then
  rs.open"select * from gonggao where id="&cint(request("id")),conn,1,3
  rs.delete
  rs.close
  response.write"<tr><td colspan=6>公告删除成功!</td></tr><meta http-equiv=refresh content='1;url=admingaog.asp'>"
  response.End()
  end if
  %>
  <tr>
    <td align="center" height="12">标题</td>
    <td align="center" height="12">类别</td>
    <td align="center" height="12">发布时间</td>
    <td align="center" height="12">操作</td>
  </tr>
  <%rs.open"select * from gonggao order by time desc",conn,1,1
  if rs.eof then
  %><tr>
    <td colspan="6" align="center" height="12">暂时没有公告!</td>
  </tr>
  <%else
  maxnum=rs.recordcount
  rs.pagesize=15
  maxpage=rs.pagecount
  if request("p")="" then
  p=1
  else
  p=cint(request("p"))
  end if
  if p>maxpage then
  p=maxpage
  end if
  if p=0 then
  p=1
  end if
  if p<>1 then
  rs.move (p-1)*rs.pagesize
  end if
  for i=1 to rs.pagesize
  if rs("flid")=0 then
  fl="首页公告"
  elseif rs("flid")=1 then
  fl="一级分类公告"
  elseif rs("flid")=2 then
  fl="二级分类公告"
  elseif rs("flid")=3 then
  fl="问题页面公告"
  end if
  %>
  <form method=post action=admingaog.asp?id=<%=rs("id")%>>
    <tr>
    <td align="center" height="25" valign="middle">
      <p align="left"><a href=../gonggao.asp?id=<%=rs("id")%> target=_blank><%=rs("title")%></a>&nbsp;</p>
    </td>
    <td align="center" height="25" valign="middle"><%=fl%>&nbsp;</td>
    <td align="center" height="25" valign="middle"><%=rs("time")%>&nbsp;</td>
    <td align="center" height="25" valign="middle"><input name="gai" type="submit" id="gai" value="修改"> <input name="del" type="submit" id="del" value="删除"></td>
  </tr></form>
  <%
  rs.movenext
  if rs.eof then exit for
  next%>
   <tr>
    <td colspan="6" align="center" bgcolor="#EEEEEE" height="27">
      <p align="left">共<font color=red><%=maxnum%></font>个公告，15个每页，页次:<font color=red><%=p%></font>/<%=maxpage%>
	<a href=admingaog.asp?p=1>首页</a>    
	<a href=admingaog.asp?p=<%=p-1%>>上页</a>    
	<a href=admingaog.asp?p=<%=p+1%>>下页</a>    
	<a href=admingaog.asp?p=<%=maxpage%>>尾页</a></p>   
    </td> 
  </tr>
  <%end if
  rs.close%>
</table>
