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

$userid=intval(get_cookie('clubuser_id'));
if ($_POST["act"]=="y"){
   $sender=get_cookie('username');
   $accepter=ftbbs_request($_POST["postuser"]);
   $title = ftbbs_request(trim($_POST["title"]));
   $content=$_POST["content"];
   $content=htmlspecialchars($content);
   
   $sql="select clubuser_id from {$tablepre}clubuser where clubuser_name='".$postuser."'";
   $rs=mysql_query($sql);
   $row = mysql_fetch_array($rs);
   $numrows = mysql_num_rows($rs);
   if ($numrows!=0){
   $str="insert into {$tablepre}sms(title,content,sender,accepter,indate,IsNew) values('".$title."','".$content."','".$sender."','".$accepter."','".$getnow."',1)";
   mysql_query($str);
   echo "<script language='javascript'>alert('发送成功！');history.go(-2);</script>";
   exit;
   }
   else{
   echo "<script language='javascript'>alert('你所发送的用户名不存在，请查对！');history.go(-2);</script>";
   exit;
   }
}
include_once("memberinfo.php");
?>
<html><head><meta http-equiv=content-type content="text/html; charset=utf-8">
</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>
<center>
<title>发送短信</title>
<link rel="stylesheet" type="text/css" href="<?=$cssfile?>">
<?
include_once("usernav.php");
include_once("bokerhead.php");
?>
<div class="stage">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="layout">
<tr>
<td valign="top" class="c2t1">
<div id="m_blog" class="modbox">
              <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
                <tr valign="middle"> 
                  <td height="40" colspan="2" align="left" class="f14"><div class="opt"> 
                      <div align="center"><strong>发送短信</strong></div>
                    </div></td>
                </tr>
                <tr> 
                  <td height="1" colspan="2" bgcolor="#336699" class=new14><spacer height="1" type="block"></td>
                </tr>
                <form name="form2" method="post" action="" style="MARGIN-BOTTOM: 0px" onsubmit="return check(this)">
                  <tr> 
                    <td width="10%" height="35"> <div align="left">用户：</div></td>
                    <td width="90%"><input name="postuser" type="text" id="postuser" value="<?=$_GET["postuser"]?>" readonly></td>
                  </tr>
				  <tr> 
                    <td width="10%" height="35"> <div align="left">标题：</div></td>
                    <td width="90%"><input name="title" type="text" id="title" value="" size="35"></td>
                  </tr>
                  <tr> 
                    <td height="15" valign="top">内容: </td>
                    <td height="15" valign="top"><textarea name="content" cols="50" rows="20" id="content"></textarea></td>
                  </tr>
                  <tr> 
                    <td height="35" valign="top">&nbsp;</td>
                    <td height="15" valign="middle">
					  <input name="act" type="hidden" id="act" value="y"> 
                      <input name="id" type="hidden" id="id" value="<?=$id?>">  
                      <input type="submit" name="Submit" value="发送短信"></td>
                  </tr>
                </form>
              </table>
              <br>
            </div>

</td>
</tr></table>
</div>
</div>
<br><center>
<?
include_once("tail.php");
?>
  </center>
</center>
</body>
</html>