<?php
/**
 * 加密记录
**/
$title='加密记录';
include './head.php';
$gls=$DB->count("SELECT count(*) from moyu_cache WHERE owner=\"".$MoYo['id']."\"");
$row_cache=$DB->query("SELECT * FROM moyu_cache");
while($res = $DB->fetch($row_cache))
{
if(!is_dir("../includes/download/".$res["space"]."/")){
$DB->query("DELETE FROM moyu_cache WHERE id='".$res["id"]."'");
}
$datetime1 = new DateTime($res["upload"]);
$datetime2 = new DateTime(date("Y-m-d H:i:s"));
$interval = $datetime1->diff($datetime2);
$aaaa=$interval->format('%R%a');
if($aaaa>7){
$DB->query("DELETE FROM moyu_cache WHERE id='".$res["id"]."'");
delDir("../includes/download/".$res["space"]."/");
}
}
?>
<script>
layer.confirm('加密记录只保存7天请及时下载！', {
  btn: ['确定'] //按钮
});
</script>
<main class="lyear-layout-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<h4>加密记录</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>程序名称</th>
<th>项目名称</th>
<th>项目日期</th>
<th> 执行操作</th>
</tr>
</thead>
<tbody>
<?php
$pagesize=10;
$pages=intval($numrows/$pagesize);
if ($numrows%$pagesize)
{
 $pages++;
 }
if (isset($_GET['page'])){
$page=intval($_GET['page']);
}
else{
$page=1;
}
$offset=$pagesize*($page - 1);

$rs=$DB->query("SELECT * FROM moyu_cache WHERE owner=\"".$MoYo['id']."\" order by id desc limit $offset,$pagesize");
while($res = $DB->fetch($rs))
{
echo '<td>'.$res['file'].'</td><td>'.$res['type'].'</td><td>'.$res['upload'].'</td><td><a href="../down.php?id='.$res['space'].'"><span class="label label-success">重新下载</span></a></td></tr>';
}
?>
</td>
</tr>
</tbody>
</table>
</div>
<center>
<?php
echo'<ul class="pagination">';
$s = ceil($gls / $pagesize);
$first=1;
$prev=$page-1;
$next=$page+1;
$last=$s;
if ($page>1)
{
echo '<li><a href="log.php?page='.$first.$link.'">首页</a></li>';
echo '<li><a href="log.php?page='.$prev.$link.'">&laquo;</a></li>';
} else {
echo '<li class="disabled"><a>首页</a></li>';
echo '<li class="disabled"><a>&laquo;</a></li>';
}
for ($i=1;$i<$page;$i++)
echo '<li><a href="log.php?page='.$i.$link.'">'.$i .'</a></li>';
echo '<li class="disabled"><a>'.$page.'</a></li>';
for ($i=$page+1;$i<=$s;$i++)
echo '<li><a href="log.php?page='.$i.$link.'">'.$i .'</a></li>';
echo '';
if ($page<$s)
{
echo '<li><a href="log.php?page='.$next.$link.'">&raquo;</a></li>';
echo '<li><a href="log.php?page='.$last.$link.'">尾页</a></li>';
} else {
echo '<li class="disabled"><a>&raquo;</a></li>';
echo '<li class="disabled"><a>尾页</a></li>';
}
echo'</ul>';
#分页
?>
</div>
</div>
</div> 
<script type="text/javascript" src="../assets/LightYear/js/jquery.min.js"></script>
<script type="text/javascript" src="../assets/LightYear/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../assets/LightYear/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="../assets/LightYear/js/main.min.js"></script>
</body>
</html>