<?
session_start();
require_once "../init.php";
require_once "../authority.inc.php";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>产品交费通知</title>
<LINK href="../share/style.css" rel=stylesheet>
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />
</head>
<body>
<? include "../share/top.php"?>
<div id="topLink">
<div id="topInfo">
	<span class="tTitle">产品管理</span>
	<span class="sarr"> >> </span><a href="<?=$GLOBALS["parentpath"]?>">返回到管理首页</a>
</div>
</div><div class="page-container">
<!--子导航-->
<? include "product_nav.inc.php"?>
<!--结束-->


        <table width="100%"  border="0" cellpadding="0" cellspacing="0" id="table" class="table">
          <tr id="tr">
            <td>产品交费通知</td>
          </tr>
          <tr height="300">
            <td align='center'>
<?
$AgentInfo = GetAgentInfo();
for($i=0;$i<count($feeHost);$i++){
	  $sql="select users.Contact_GB,users.Email,host.Domain,host.dtCreate from host left join users on host.UserName=users.UserName where IDHost=$feeHost[$i]";
	  $resultset=$DB->query($sql);
	  $UInfo=$DB->fetch_array($resultset);
	  $day=round((strtotime("now")-strtotime($UInfo[dtCreate]))/3600/24);
	  $endday=date("Y-m-d",strtotime("$UInfo[dtCreate] +3 day"));
	  $sendday=date("Y-m-d");
$body="
尊敬的用户 $UInfo[Contact_GB] :
	您好，您在我司申请的产品( $UInfo[Domain] )已试用了 $day 天，请在 $endday 前交费，否则系统将会
自动删除您的产品,谢谢合作。
																			".$AgentInfo[Company]."
																			$sendday
";
	  $email=new MailTemplate($body);
	  $email->SmtpServer = $AgentInfo[SmtpServer] ; 
	  $email->SmtpUser = $AgentInfo[SmtpUser] ;
	  $email->SmtpPW = $AgentInfo[SmtpPW] ;
	  $res=$email->sendmail($UInfo[Email],"$UInfo[Domain] 产品交费通知",$AgentInfo[Company]."<".$AgentInfo[SmtpUser].">");
	  if($res)echo "邮件已成功发送到 $UInfo[Contact_GB] 的邮箱 $UInfo[Email] <br>";
	  else{ 
	     echo $email->smtp->result_str;
	  }
	  flush();
}
?>
            </td>
        </table>
</div>
<? 
$DB->close();
include "../share/bottom.php";
?>
</body>
</html>