<?
$sub_menu = "200300";
include_once("./_common.php");

auth_check($auth[$sub_menu], "r");

$token = get_token();

$html_title = "群发邮件";

if ($w == "u") {
    $html_title .= "修改";
    $readonly = " readonly";

    $sql = " select * from $g4[mail_table] where ma_id = '$ma_id' ";
    $ma = sql_fetch($sql);
    if (!$ma[ma_id]) 
        alert("没有可以显示的数据");
} else {
    $html_title .= "输入";
}

$g4[title] = $html_title;
include_once("./admin.head.php");
?>

<form name=fmailform method=post action="./mail_update.php" onsubmit="return fmailform_check(this);">
<input type=hidden name=w     value='<?=$w?>'>
<input type=hidden name=ma_id value='<?=$ma[ma_id]?>'>
<input type=hidden name=token value='<?=$token?>'>
<table cellpadding=0 cellspacing=0 width=100%>
<colgroup width=20% class='col1 pad1 bold right'>
<colgroup width=80% class='col2 pad2'>
<tr>
    <td colspan=2 class=title align=left><img src='<?=$g4[admin_path]?>/img/icon_title.gif'> <?=$html_title?></td>
</tr>
<tr><td colspan=2 class='line1'></td></tr>
<tr class='ht'>
    <td>邮件标题</td>
    <td><input type=text class='ed w99' name=ma_subject value='<?=$ma[ma_subject]?>' required itemname='邮件标题'></td>
</tr>
<tr>
    <td>邮件内容</td>
    <td class=lh>
        <?=textarea_size("ma_content")?>
        <textarea id=ma_content name=ma_content rows=20 class='ed w99'  required itemname='邮件内容'><?=$ma[ma_content]?></textarea>
        <br>{名称} , {昵称} , {会员id} , {邮件地址} , {生日}
        <br>可以使用以上变量编辑邮件内容 支持html代码
    </td>
</tr>
<tr><td colspan=2 class='line1'></td></tr>
</table>

<p align=center>
    <input type=submit class=btn1 accesskey='s' value='  确  定  '>
</form>



<script language="javascript">
function fmailform_check(f) 
{
    errmsg = "";
    errfld = "";

    check_field(f.ma_subject, "请输入邮件标题");
    check_field(f.ma_content, "请输入邮件内容");

    if (errmsg != "") {
        alert(errmsg);
        errfld.focus();
        return false;
    }
    return true;
}

document.fmailform.ma_subject.focus();
</script>

<?
include_once("./admin.tail.php");
?>
