<?php

	include '../user.php';
	include '../global.php';
	include '../config.php';
	include '../../header.php';

	$user = $_COOKIE['AnYue_Admin_User'];
	$pass = $_COOKIE['AnYue_Admin_Pass'];

	if ($user != $username or $pass != $password){
	header('refresh:0;url=../login.php');
}else{
?>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #F8F9FA;
}
-->
</style>

<link href="../images/skin.css" rel="stylesheet" type="text/css" />
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="../images/mail_leftbg.gif"><img src="../images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="../images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">邮件设置</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="../images/mail_rightbg.gif"><img src="../images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="../images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="left_txt">当前位置：邮件设置</td>
          </tr>
          <tr>
            <td height="20"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
              <tr>
                <td></td>
              </tr>
            </table>
			</td>
          </tr>
          <tr>
            <td>
			<table width="100%" height="55" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="10%" height="55" valign="middle"><img src="../images/title.gif" width="54" height="55"></td>
                <td width="90%" valign="top"><span class="left_txt2">请在此配置您的系统发信邮箱</span><span class="left_txt3">基本参数</span><span class="left_txt2">！</span><br>
                          <span class="left_txt2">主要</span><span class="left_txt3">包括：SMTP服务器，SMTP端口号，SMTP用户名，SMTP登录密码</span><span class="left_txt2">。</span></td>
              </tr>
            </table>
			</td>
          </tr>
		  <?php
		  if (!empty ($_POST['B1'])){
			  $configure['SMTP-fwq'] = $_POST['SMTP-fwq'];
			  $configure['SMTP-dkh'] = $_POST['SMTP-dkh'];
			  $configure['SMTP-user'] = $_POST['SMTP-user'];
			  $configure['SMTP-pass'] = $_POST['SMTP-pass'];  
			  AnYue_ConFig ($configure);
			  echo '<div align="center" style="color: #FF0000"><span style="color: #00FFFF">■■■■■■■■■</span> 修改成功！ <span style="color: #00FFFF">■■■■■■■■■</span></div>';
		  }else if (!empty ($_POST['B2'])){
		  $csmail = $_POST['csmail'];
		  if ($csmail != ''){
				Send_out_Mail ($csmail,'[暗月挂Q系统] 邮件功能测试','[暗月挂Q系统] 邮件功能测试：<br><br><br>若您可以看到此邮件，表示您成功了！');
				echo '<div align="center" style="color: #FF0000"><span style="color: #00FFFF">■■■■■■■■■</span> 测试邮件发送成功！ <span style="color: #00FFFF">■■■■■■■■■</span></div>';
		  }else{
				echo '<div align="center" style="color: #FF0000"><span style="color: #00FFFF">■■■■■■■■■</span> 测试邮箱地址不能为空！ <span style="color: #00FFFF">■■■■■■■■■</span></div>';
		  }
		  }
		  ?>
		  <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
              <tr>
                <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;邮箱配置</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<form name="form1" method="POST" action="">
              <tr>
                <td width="20%" height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">SMTP服务器：</td>
                <td width="3%" bgcolor="#f2f2f2">&nbsp;</td>
                <td width="32%" height="30" bgcolor="#f2f2f2"><input name="SMTP-fwq" type="text" id="SMTP-fwq" value="<?=$configure['SMTP-fwq']?>" size="30" /></td>
                <td width="45%" height="30" bgcolor="#f2f2f2" class="left_txt">SMTP服务器地址，例如：smtp.163.com</td>
              </tr>
              <tr>
                <td height="30" align="right" class="left_txt2">SMTP端口号：</td>
                <td>&nbsp;</td>
                <td height="30"><input type="text" name="SMTP-dkh" value="<?=$configure['SMTP-dkh']?>" size="30" /></td>
                <td height="30" class="left_txt">SMTP服务器端口号，例如：465</td>
              </tr>
              <tr>
                <td height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">SMTP用户名：</td>
                <td bgcolor="#f2f2f2">&nbsp;</td>
                <td height="30" bgcolor="#f2f2f2"><input type="text" name="SMTP-user" value="<?=$configure['SMTP-user']?>" size="30" /></td>
                <td height="30" bgcolor="#f2f2f2" class="left_txt">SMTP用户名，例如：yixuegq@163.com</td>
              </tr>
			  <tr>
                <td height="30" align="right" class="left_txt2">SMTP登录密码：</td>
                <td>&nbsp;</td>
                <td height="30"><input type="text" name="SMTP-pass" value="<?=$configure['SMTP-pass']?>" size="30" /></td>
                <td height="30" class="left_txt">SMTP账号登录密码，例如：123456</td>
              </tr>
              <tr>
                <td height="17" colspan="4" align="right" >&nbsp;</td>
              </tr>
              <tr>
                <td height="30" colspan="4" align="right" class="left_txt2"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                  <tr>
                    <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;用户配置</td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">接受邮件地址：</td>
                <td bgcolor="#f2f2f2">&nbsp;</td>
                <td height="30" bgcolor="#f2f2f2"><input type="text" name="csmail" size="30" /></td>
                <td height="30" bgcolor="#f2f2f2" class="left_txt"><input type="submit" value="测试发信" name="B2" /></td>
			  </tr>
            </table></td>
          </tr>
        </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
            <tr>
              <td width="50%" height="30" align="right"><input type="submit" value="确定修改" name="B1" /></td>
              <td width="6%" height="30" align="right">&nbsp;</td>
              <td width="44%" height="30"><a href=""><input type="reset" value="取消设置" name="B12" /></a></td>
            </tr>
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
          </table>
		 </form>
		</td>
      </tr>
    </table></td>
    <td background="../images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="../images/mail_leftbg.gif"><img src="../images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="../images/buttom_bgs.gif"><img src="../images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="../images/mail_rightbg.gif"><img src="../images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
<?php } ?>