<%@ CODEPAGE = "936" %>
<!--#include file="Connections.asp" -->
<!--#include file="bbs.css" -->
<!--#include file="top.asp" -->
<!--#include file="ubb.asp" -->


<title>留言公告</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<% if   Request.QueryString("action")="" then%>
<% sql="select * from announce order by a_time desc"
set rs=conn.execute(sql)
%>
<center>
  <table width="760"  border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="<%=bgcolor%>" style="border-collapse: collapse">
  <tr align="center"> 
    <td height=24 colspan="3" class=tdc1 <%=hColor%>><strong>留言公告</strong></td>
  </tr>
  <% if rs.bof and rs.eof then%>

  <tr align="center"> 
    <td bgcolor=<%=tColor2%> class=tdc height=23 width="10%">   <%if Session("book")<>"" then%><a href="announce.asp?action=post">发布公告</a><% end if%></td>
    <td bgcolor=<%=tColor2%> class=tdc height=23><BR>暂无公告<BR><BR></td>
    <td bgcolor=<%=tColor2%> class=tdc height=23 width="10%"></td>
  </tr>
  <%else%>
  <% do while not rs.eof%>
  <tr align="center"> 
    <td <%=tColor%> class=tdc1 height=23 width="10%">   <%if Session("book")<>"" then%><a href="announce.asp?action=post">发布公告</a><%end if%></td>
    <td <%=tColor%> class=tdc1 height=23>&gt;&gt;<%=rs("a_title")%>&lt;&lt;</td>
    <td <%=tColor%> class=tdc1 height=23 width="10%"> <%if Session("book")<>"" then%><a href="announce.asp?action=del&a_id=<%=rs("a_id")%>">删除公告</a><% end if%></td>
  </tr>
  <tr align="left"> 
    <td colspan="3" bgcolor=<%=tColor2%> class=tdc><%=ubbcode(rs("a_content"))%>　</td>
  </tr>
  <tr> 
    <td align="left" bgcolor=<%=tColor1%> class=tdc colspan="3">发布者：<%=rs("a_username")%>  发布时间：<%=rs("a_time")%></td>
  </tr>


<% rs.movenext
loop
set rs=nothing%>

    
    
      



<% end if%>
</table>
</center>

<%elseif  Request.QueryString("action")="del" then
 if Session("book")="" then
response.redirect("login.asp")
else
a_id=request.querystring("a_id")
sql="delete * from announce where a_id="&a_id&""
conn.execute(sql)
response.redirect"announce.asp"
end if
 %>
<%elseif  Request.QueryString("action")="post" then
if Session("book")="" then
response.redirect("login.asp")
end if
if Request.QueryString("mode")="add" then
a_username=request.form("a_author")
a_content=request.form("textfield3")
a_title=request.form("textfield")
sql="insert into announce (a_title,a_content,a_username,a_time) values('"&a_title&"','"&a_content&"','"&a_username&"','"&now()&"')"
conn.execute(sql)
response.redirect"announce.asp"
response.end
end if

 %>
<div align="center">
  <center>
<table width="760"  border="1" align="center" cellpadding="4" cellspacing="1" bordercolor="<%=bgcolor%>" style="border-collapse: collapse">
    <tr align="center"> <form ACTION="announce.asp?action=post&mode=add" METHOD="POST" name="form1">
      <td colspan="2" <%=hColor%> class=tdc1 height=25>发布公告</td>
    
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>发布者：</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        <input type="text" name="a_author" value="<%=Session("book")%>" size="20" class=bdtj3>
      </td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>公告标题：</td>
      <td  bgcolor=<%=tColor2%> class=tdc> 
        <input name="textfield" type="text"  class=bdtj3 size="20" maxlength="20">
      </td>
    </tr>
    <tr> 
      <td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>公告内容：</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        <textarea name="textfield3" cols="50" rows="8" class=bdtj3></textarea>
      </td>
    </tr>
    <tr> 
      <td bgcolor=<%=tColor2%> class=tdc>　</td>
      <td bgcolor=<%=tColor2%> class=tdc> 
        <input type="submit" name="Submit" value="提交" class=bdtj>
        <input type="reset" name="Submit2" value="重设" class=bdtj>
      </td>
    </tr>
</form>
  </table>

  </center>
</div>


<% end if%>