<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("inc/pageclass.php");
include_once("inc/ftcode.php");
include_once("conn.php");
include_once("checkuser.php");
include_once("ftbbs_nav.php");
include_once("bbsuser.php");

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
$defaulthome=$ftbbsmb[31];

$username=get_cookie('username');
include_once("homeurl.php");

$id=intval($_GET["id"]);
if ($_POST["act"]=="y"){
   $title = ftbbs_request(trim($_POST["title"]));
   $title = nohtml($title);
   $content=$_POST["content"];
   $content=htmlspecialchars($content);
   $sql="update {$tablepre}sms set title='".$title."',content='".$content."' where id='".$id."'";
   mysql_query($sql);
   header("Location:mysms.php");
}
$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">
<script language=javascript src="inc/cookies.js"></script>
<script>
var stylecook = getCookie("STYLESHOW");
var style;
var strstyle;
if(stylecook=="")
{
 stylecook=1;
}
else
{
 stylecook++;
}
style="main0"+stylecook+".css";
strstyle="<link href=\"css/"+style+"\"  rel=\"stylesheet\" type=\"text/css\"> ";
document.write(strstyle);
</script>
<title><?=$username?>的收件箱</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">
<?
if (get_cookie('ftbbstype')==1){
include_once("pbhead.php");
}
?>
<TABLE align=center border=0 cellPadding=0 cellSpacing=1 class="maintbbg" width="99%">
    <TR> 
      <TD height=25 class="f12bg"> &nbsp;<?=$userinfo?></TD>
    </TR>
    <tr> 
      <td height="25" colspan="3" class="maintbtr3">&nbsp;<a href="<?=$homepage?>">论坛首页</a> >> 编辑短信：</td>
    </tr>
</TABLE> 
<table cellspacing=0 cellpadding=0 width="99%" align=center border=0>
  <tr> 
    <td height=5></td>
  </tr>
</table>
<TABLE align=center border=0 class="listborder" cellspacing="1" cellpadding="0" width="99%">
    <TBODY>
    <TR> 
      <TD height=28 class="td004"> <div align="center"> 
          <form name="form1" method="post" action="mysms.php" style="MARGIN-BOTTOM: 0px">
            短信搜索: 
            <input name="searchstr" type="text" id="searchstr" size="25">
            <select name="smtype" id="smtype">
              <option value="title" selected>短信标题</option>
              <option value="content">短信内容</option>
            </select>
            <input type="submit" name="Submit" value="查找短信">
            <input name="button" type="button" id="button" value="发送短信" onClick="javascript:window.location.href='smsbbs.php'">
            <input name="send" type="button" id="send" value="收件箱" onClick="javascript:window.location.href='mysms.php'">
            <input name="re" type="button" id="re" value="发件箱" onClick="javascript:window.location.href='mysms.php?t=my'">
          </form>
          <font color="#FFFFFF"></font></div></TD>
    </TR>
      <TR class="table001"> 
        <TD height="28" vAlign=middle class="maintbtr1"> 
          <div align="center">编辑短信</div></TD>
      </TR>
	  <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="20%" height="50" class="f12"><div align="right">标题:</div></td>
                  <td width="76%"><input name="title" type="text" id="title" value="<?=$title?>" size="50"></td>
                </tr>
                <tr> 
                  <td height="25" class="f12"><div align="right">内容:</div></td>
                  <td><textarea name="content" cols="70" rows="20" id="content"><?=$content?></textarea></td>
                </tr>
                <tr> 
                  <td height="30"><div align="right"></div></td>
                  <td><input type="submit" name="Submit" 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>
<?
$db->close(); 
include_once("inc/bbstail.php");
?>
</body>
</html>