<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>数据备份、还原</title>
<LINK href="<?=base_url()?>csdj/admin/images/admin.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<?=base_url()?>csdj/admin/js/admin.js"></script>
<script type="text/javascript" src="<?=base_url()?>csdj/admin/js/ajaxrequest.js"></script>
</head>
<BODY style="margin:2px">
<form method="post" action="<?=site_url('admin/tools/thsave/')?>" name="myform">
<table align="center" border="1" cellspacing="0" cellpadding="5" bordercolor="#C4DFF4" width="950" style="border-collapse:collapse;">
<tr><td align="center" height="20" colspan="4" class="title">数据库操作</td></tr>

<tr>
      <td align="center">选</td>
      <td align="center">数据表</td>
      <!--td align="center">总数量</td-->
      <td align="center">选</td>
      <td align="center">数据表</td>
      <!--td align="center">总数量</td-->
</tr>
<tr>
<?php
 $tables = $this->db->list_tables();
 $k=1;
 foreach ($tables as $table) { 
    if(strpos($table,CS_SqlPrefix) !== FALSE){
      	   //$query=$this->db->get($table);
           //$nums=$query->num_rows();
?>
      <td align="center"><input type=checkbox Name="CS_ID[]" id="CS_ID[]" Value="<?=$table?>" checked></td>
      <td align="center"><?=$table?></td>
      <!--td align="center"><?=$nums?></td-->
<?php
      if($k%2!=1) echo '</tr><tr>';
      $k=$k+1;
    }
 } 
?>
</tr>
<tr>
      <td colspan="4" align="center">
           <input type="checkbox" name="chkall" onclick="CheckAll(this.form)" value="ON" checked>选中&nbsp;&nbsp;
          <input type="button" class="italk-st3" value="优化数据表" onClick="baseedit('<?=site_url('admin/tools/yhbase/')?>');">&nbsp;&nbsp;
          <input type="button" class="italk-st3" value="修复数据表" onClick="baseedit('<?=site_url('admin/tools/xfbase/')?>');">
      </td>
</tr>
</form> 
<tr>
</table>
<table align="center" border="1" cellspacing="0" cellpadding="5" bordercolor="#C4DFF4" width="950" style="border-collapse:collapse;">
<form method="post" name="base" action="<?=site_url('admin/tools/backup/')?>" target="base_msg">
<tr><td align="center" height="20" colspan="6" class="title">备份/还原</td></tr>
<tr>
     <td width="15%" align="right"> 数据分卷大小：</td>
	 <td width="15%"><input type="text" id="size" name="size" size="10" value="1024" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">&nbsp;KB</td>
     <td width="15%" align="right"> 是否压缩下载：</td>
	 <td width="15%"><label><input type="radio" id="zip" name="zip" value="ok" checked/>开启</label>&nbsp;<label><input type="radio" id="zip" name="zip" value="no"/>关闭</label></td>
     <td width="20%" align="center"><input type="submit" class="italk-bt" value="开始备份" onClick="basebackup('basemsg');"></td>
	 <td width="20%" align="center"><INPUT TYPE=BUTTON class="italk-bt" value=" 开始还原 "  onClick="basebackup('restore');"></td>
</form> 
</tr>
<tr>
     <td align="center" style="display:none;" id="restore" colspan="6">
<?php
 if($strs){
    foreach ($strs as $value) {
      if(is_dir('./attachment/backup/'.$value['name'])){
        echo '<a style="COLOR: red" href="javascript:;" onClick="baserestore(\''.$value['name'].'\');" title="点击开始还原">《'.$value['name'].'》</a>&nbsp;&nbsp;';
      }
    }
 }else{
        echo '没有备份记录!';
 }
?>
     </td>
</tr>
<tr>
     <td style="display:none;" id="basemsg" colspan="6"><iframe name="base_msg" frameborder="0" id="base_msg" width="100%" height="200"></iframe></td>
</tr>
<tr>
<td colspan="6"><br><br><br></td>
</tr>
</table>
</body>
</html>


