<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.sql.*"%> 
<%@ page import="java.util.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.*"%>
<%@ include file="checkbbsuser.jsp"%>
<%@ include file="../inc/conn.jsp"%>
<%
String sql,sender,accepter,title,content;
String act = request.getParameter("act");
String id = request.getParameter("id");
if(act!=null)
{
//sender=(String)session.getAttribute("name");
title=new String(request.getParameter("title").getBytes("iso-8859-1"));
content=new String(request.getParameter("content").getBytes("iso-8859-1"));

sql="update sms set title='"+title+"',content='"+content+"' where id="+id;
stmt.executeUpdate(sql);
out.print("<script language='javascript'>");
out.print("alert('修改成功！');");
out.print("history.go(-2);");
out.print("</script>");
out.close();
stmt.close(); 
conn.close();
}
else
{
sql="select * from sms where id="+id;
ResultSet rs=stmt.executeQuery(sql);
rs.next();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/xmwuye.css" rel=stylesheet type=text/css>
<title>论坛短信系统</title>
</head>
<script language="javascript">
<!--
	function check(form)
	{
    if (form.title.value=="")
    	{
    		alert("请填写标题！");
    		form.title.focus();
    		return false;
  	}
    if (form.content.value=="")
    	{
    		alert("请填写内容！");
    		form.content.focus();
    		return false;
  	}
return true;
	}
//-->
</script>
<body topmargin="5">
<div align="center">
  <TABLE align=center bgColor=#a4b6d7 border=0 cellPadding=0 cellSpacing=0 width="99%">
    <TR> 
      <TD height=25> <div align="center"><font color="#FFFFFF"><strong>欢迎<font color="#CC3300"><%=session.getAttribute("name")%></font>网友来编辑短信</strong></font></div></TD>
    </TR>
  </TABLE>
  <TABLE align="center" bgColor="#a4b6d7" border=0 cellPadding=0 cellSpacing=0 width="99%">
    <TBODY>
      <TR bgColor=#f2f8ff> 
        <TD height="28" vAlign=middle bgColor=#b1d6fa class=font10_5> 
          <div align="center">编辑短信</div></TD>
      </TR>
    </TBODY>
  </TABLE>
  <TABLE width="99%" border=0 align="center" cellPadding=0 cellSpacing=0 bgColor="#FFFFFF">
    <TBODY>
      <TR bgColor=#f2f8ff> 
        <TD vAlign=middle bgColor=#f6f6f6 class=font10_5><div align="center">
            <form name="form2" method="post" action="" style="MARGIN-BOTTOM: 0px" onsubmit="return check(this)">
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr> 
                  <td width="17%" height="30"> <div align="right">标题:</div></td>
                  <td width="83%"><input name="title" type="text" id="title" value="<%=rs.getString("title")%>" size="50"></td>
                </tr>
                <tr> 
                  <td height="25"><div align="right">内容:</div></td>
                  <td><textarea name="content" cols="70" rows="20" id="content"><%=rs.getString("content")%></textarea></td>
                </tr>
                <tr> 
                  <td height="30"><div align="right"></div></td>
                  <td><input type="submit" name="Submit2" value="修改"> <input name="cannel" type="reset" id="cannel" value="重置"> 
                    <input name="act" type="hidden" id="act" value="y"> <input name="id" type="hidden" id="id" value="<%=id%>"> 
                  </td>
                </tr>
              </table>
            </form>
          </div></TD>
      </TR>
    </TBODY>
  </TABLE>
  <script language="JavaScript" src="../inc/bbstail.js"></script>
</div>
</body>
</html>
<%}%>