<?php session_start();
$hostname=$_SESSION[host];
$username=$_SESSION[user];
$userpwd=$_SESSION[pwd];
if(!$mbox=@imap_open("$hostname","$username","$userpwd")){
   echo "<script>alert('登录超时，请重新登录!');history.back();</script>";
   exit;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查看邮件发送记录</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<style type="text/css">
<!--
body {
	background-image: url(images/mrbg.gif);
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
</head>
<script language="javascript" src="js/checkbox.js"></script>
<script language="javascript">
  function chkinput(form){
    if(form.content.value==""){
	  alert("请输入要查找的内容！");
	  form.content.select();
	  return(false);
	}
   var i=form.content.value.indexOf("@");
	var j=form.content.value.indexOf(".");
	if((form.method.value=="1")&&((i<0)||(i-j>0)||(j<0)))
	 {
       alert("请输入正确的收件人E-mail地址!");
	   form.content.select();
	   return(false);
	 }	
  
  }

</script>
<body>
<table width="575" height="104" border="0" cellpadding="0" cellspacing="0" background="images/首页(2)_5.jpg">
  <tr>
    <td width="82" height="60">&nbsp;</td>
    <td width="493">&nbsp;</td>
  </tr>
  <tr>
    <td height="32">&nbsp;</td>
    <td><span class="STYLE34"><?php echo $lmbs;?></span></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="550" height="421" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top">  <form name="form1" method="post" action="sendmail_select_ok.php">
          <table width="545" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#C6C5CA">
            <tr align="center" bgcolor="#BBE323">
              <td width="35" bgcolor="#FFFFFF">&nbsp;</td>
              <td width="140"  height="25" bgcolor="#FFFFFF" class="STYLE1">邮件主题</td>
              <td width="100" bgcolor="#FFFFFF" class="STYLE1">发件人</td>
              <td width="170" bgcolor="#FFFFFF" class="STYLE1">发件时间</td>
              <td width="100" bgcolor="#FFFFFF" class="STYLE1">收件人</td>
            </tr>



 
<?php
include_once ('conn/conn.php');						//载入adodb.ini.php文件

   $sql="select * from tb_mail_log where tb_mail_formuser='".$_SESSION[user]."'";			//查询语句
	$num = 5;										//每页显示的记录数
	if(isset($_GET['n_page'])){						//判断当前页码
		$c_page = $_GET[n_page];					//将$n_page赋给变量$c_apge
	}else{
		$c_page = 1;								//初始化变量$c_page
	}
	$rst = $conn -> PageExecute($sql,$num,$c_page);	//执行pageExecute函数

	$ret=$conn->Execute($sql);
	$record=count($ret->GetRows());					//统计总的记录数

if($rst->EOF){
	
?>
<tr><td colspan="6" align="center" bgcolor="#FFFFFF" class="STYLE1">没有数据</td>
</tr>
<?php 
}else{
while(!$rst -> EOF){							//配合wihle语句循环输出结果

?>
<tr>
  <td align="center" bgcolor="#F8F8F8"><input type="checkbox" name="check[]" value="<?php echo $rst->fields[0];?>" /></td>
<td align="center" bgcolor="#F8F8F8" class="STYLE1"><span class="STYLE1">
      <?php echo $rst->fields[4];?>
    </span></td>
  
    <td align="center" bgcolor="#F8F8F8" class="STYLE1"><span class="STYLE1">
       <?php echo $rst->fields[2];?>
    </span></td>
    <td align="center" bgcolor="#F8F8F8" class="STYLE1"><span class="STYLE1">
     <?php echo $rst->fields[5];?>
    </span></td>
 <td align="center" bgcolor="#F8F8F8" class="STYLE1"><span class="STYLE1">
     <?php echo $rst->fields[3];?>
    </span></td>    
</tr>
<?php 
	$rst -> movenext();										//指针下移
}
?>
 <tr>
     <td height="25" colspan="5" align="center" bgcolor="#FFFFFF"><input name="button" type=button class="buttoncss" onClick="checkAll(form1,status)" value="全选">
<input type=button value="反选" class="buttoncss" onClick="switchAll(form1,status)">
<input type=button value="不选" class="buttoncss" onClick="uncheckAll(form1,status)"></td>
            </tr>
<tr><td colspan="7" bgcolor="#FFFFFF">

    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="46"><input name="delete" type="submit" class="buttoncss" id="delete" value="删除"></td>
        <td width="66" class="STYLE1">&nbsp;总计<?php echo $record; ?>条</td>
       <td width="145" class="STYLE1">


<font color='#999999'>当前第<?php echo $rst -> absolutePage(); ?>页/总计<?php echo $rst -> LastPageNo(); ?>页</font></td>
<td width="195" class="STYLE1">
<?php


		if(!$rst -> AtfirstPage()){					//如果当前页不是首页
?>



<!--  输出向上翻页超链接  -->
		<a href ="index.php?lmbs=<?php echo $_GET[lmbs];?>&&n_pge=1"> 首页 </a>
		<a href ="index.php?lmbs=<?php echo $_GET[lmbs];?>&&n_page=<?php echo $rst -> absolutePage() - 1; ?>"> 上一页 </a>
<!--  ----------------------------  -->
<?php
		}
		if(!$rst -> AtlastPage()){					//如果当前页不是尾页
?>
<!--  输出向下翻页超链接  -->
		<a href = "index.php?lmbs=<?php echo $_GET[lmbs];?>&&n_page=<?php echo $rst -> absolutePage() + 1; ?>"> 下一页 </a>
		<a href ="index.php?lmbs=<?php echo $_GET[lmbs];?>&&n_page=<?php echo $rst -> LastPageNo(); ?>"> 尾页 </a>	
<!--  -----------------------------  -->

<?php
		}

?></td>
      </tr>
    </table></td>
</tr>
<?php }?>
          </table>
        </form>     </td>
      </tr>
</table>
<?php
imap_close($mbox);
?>
</body>
</html>
