<?
include_once("../inc/config.php");
include_once("../inc/publicfun.php");
include_once("../inc/ftbbsdbclass.php");
include_once("../inc/ftcode.php");
include_once("../conn.php");
include_once("check_master.php");

$id=$_GET["id"];

if ($_POST["act"]=="y"){
   $title = ftbbs_request(trim($_POST["title"]));
   $content=$_POST["content"];
   $content=htmlspecialchars($content);
   $str="update {$tablepre}sms set title='".$title."',content='".$content."' where id=".$id;
   mysql_query($str);
   $db->close(); 
   echo "<br><br><br><br><br><center>修改成功!<a href=managesms.php>返回管理页</a></center>";
   exit;
}
else{
  $sqlstr="select * from {$tablepre}sms where id='".$id."'";
  $rs=mysql_query($sqlstr);
  $myrow = mysql_fetch_array($rs);
  $title=$myrow["title"];
  $content=$myrow["content"];
  $content=htmltocode($content);
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK href="../css/main01.css" rel=stylesheet type=text/css>
<title>论坛短信系统</title>
</head>
<body topmargin="5">
<div align="center"> 
  <TABLE width="99%" border=0 align="center" cellPadding=0 cellSpacing=0 bgColor="#FFFFFF" class="default_list">
    <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">
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr class="nar"> 
                  <td height="28" colspan="2"> 
                    <div align="center" ><font color="#FFFFFF"><strong>编辑短信</strong></font></div></td>
                </tr>
				<tr class="f12"> 
                  <td width="20%" height="40"> 
                    <div align="right">标题:</div></td>
                  <td> 
                    <input name="title" type="text" id="title" value="<?=$myrow["title"]?>" size="50"></td>
                </tr>
                <tr class="f12"> 
                  <td height="25"> 
                    <div align="right">内容:</div></td>
                  <td> 
                    <textarea name="content" cols="70" rows="20" id="content"><?=$myrow["content"]?></textarea></td>
                </tr>
                <tr class="f12"> 
                  <td height="50"> 
                    <div align="right"></div></td>
                  <td> 
                    <input type="submit" name="Submit2" value="修改" <? if (false===strrpos($_SESSION["admin_qs"],"2")){?>disabled<? }?>>
                    <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> 
</div>
</body>
</html>