<?php defined('PHPNEW_STATIC_TPL') === false && exit(URL_HOST);?>
<style type="text/css">
    .ptitle{height: 30px; line-height: 30px; font-weight: bolder; font-size: 13px; color: #353939;}
    .thread_date{font-size:12px; margin-left: 8px; font-weight: normal;}
    .ptitle a:hover{ color: #FF8040;}
    .my_table{line-height: 2em; margin-bottom: 20px;}
    .my_table td{ border-bottom: 1px dotted $c1; height: 30px; line-height: 30px; text-align: center;}
    .my_table th{ border-bottom: 2px solid $c1; color: $c1; font-weight: bolder; text-align: center;}
    .hig td{background-color: #F4EED9;}
    .dbpriv_table{background-color: white;}
</style>
<script type="text/javascript">
    var shown = '0';
    function fieldsshow(N){
        if(shown == N){
            $('.dbpriv_'+N).hide();
            shown = 0;
            return false;
        }
        shown = N;    
        $('.dbpriv').hide();
        $('.dbpriv_'+N).show();
    }
    var i = 0;
    var str = '正在备份 ';
    var objs =0;
    function submitpost(obj){
        if(i == 0){
            objs = obj;
        }else{
            if(obj != 'b'){
                alert('正在加载中...');
                return false;
            }
        }
        i += 1;
        strs = str+'['+i+']';
        $(objs).val(strs);
        setTimeout('submitpost("b")',1000);
        return true;
    }
</script>
<div>
<form method="post" id="form1" action="{ADM_GET_URL}" enctype="application/x-www-form-urlencoded">
<table class="my_table">
    <tr class="admin_list">
        <th style="width: 30px;">可选</th>
        <th style="width: 164px;">数据表名</th>
        <th style="width: 40px;">字段</th>
         <th>记录行数</th>
          <th>数据容量</th>
          <th>索引容量</th>
           <th>类型/字符集</th>
           <th>极限容量</th>
            <th>更新时间</th>
    </tr>
    <!--{loop $dbpriv $val}-->
    <tr>
        <td>
        <!--{if $val[safedata]}-->
            <input type="checkbox" name="fields[]" checked="checked" style=" border: none; border: 1px solid green;" value="{$val[Name]} " />
        <!--{else}-->
            <input type="checkbox" name="fields[]" value="{$val[Name]} " style=" border: none; border: 1px solid #FF8040;" onclick="alert('单表容量大于500MB, 请慎重选择!')" />
        <!--{/if}-->
        </td>
        <td>{$val[Name]} <span style="color: #004080; font-weight: bolder; cursor: pointer;" onclick="fieldsshow('{$val[Name]}')">[+]</span></td>
        <td>{$val[fields]}个</td>
        <td>{$val[Rows]}</td>
        <td>{$val[Data_length]}</td>
        <td>{$val[Index_length]}</td>
        <td>{$val[Engine]} , {$val[Collation]}</td>
        <td>{$val[Max_data_length]}</td>
        <td>{$val[Update_time]}</td>
    </tr>
    <tr class="dbpriv dbpriv_{$val[Name]}" style="display: none;">
        <td colspan="10">
            <div style="margin: 6px; margin-left: 30px;">
            <table style="width: 100%; border-top: 3px solid #FF8040;" class="dbpriv_table">
                <!--{loop $val[subset] $vals}-->
                <tr>
                    <td style="width: 120px;">{$vals[Field]}</td>
                    <td  style="width: 180px;">{$vals[Type]}</td>
                    <td style="width: 120px;">{$vals[Collation]}</td>
                    <td style="width: 60px;">{$vals[Null]}</td>
                    <td style="width: 60px;">{$vals[Key]}</td>
                    <td style="width: 60px;">{$vals[Default]}</td>
                    <td style="width: 120px;">{$vals[Extra]}</td>
                </tr>
                <!--{/loop}-->
                <!--{if $val[error]}-->
                    <tr>
                        <td colspan="9"> {$val[error]}</td>
                    </tr>
                <!--{/if}-->
            </table>
            </div>
        </td>
    </tr>
    <!--{/loop}-->
    <!--{if !$dbpriv}-->
    <tr>
        <td colspan="10" style="text-align: center; line-height: 60px; height: 60px;">   mysql 用户权限不足[show] !!! <br /></td>
    </tr>
    <!--{/if}-->
    <tr>
        <td style="text-align: left;" colspan="4"><input style="margin-left: 6px;" onclick="return submitpost(this);" type="submit" value="备份" />　 数据库: <select>
        <!--{loop $dbarr $val}--> 
            <!--{if $DBNAME === $val}-->
                <option selected="selected">{$val}</option>
            <!--{else}-->  
                <option onclick="js_header('./index.php?admincp=db_back&name={eval echo urlencode($val)}.html');">{$val}</option>
            <!--{/if}-->
        <!--{/loop}-->
        </select></td>
        <td colspan="5" style="text-align: right;"> 总容量:{$allcount}, 索引量: {$indexcount}</td>
    </tr>
</table>
</form>

<table class="my_table">
    <tr class="admin_list">
        <th style="width: 130px;">数据库</th>
        <th style="width: 134px;">备份时间</th>
        <th>备份大小</th>
         <th>备份路径</th>
   </tr>
    <!--{loop $filearr $val}-->
    <tr>
        <td>{$val[sqlname]}</td>
        <td>{$val[ctime]}</td>
        <td>{$val[size]}</td>
        <td><a href="{$val[name]}">{$val[name]}</a> - [<a href="./index.php?admincp=db_back&dele={$val[ensqlname]}.html" style="color: red;"{GET_ALERT}>Dele</a>]</td>
    </tr>
    <!--{/loop}-->
    <!--{if !$filearr}-->
        <tr>
            <td colspan="20" style=" text-align: center;">
                暂时没有任何备份信息!
            </td>
        </tr>
    <!--{/if}-->
    <tr>
        <td colspan="20" style="text-align: left; line-height: 20px;">
        <strong>说明</strong>: <br />
          　一个数据库对应一个备份文件, 利用随机码计算MD5命名, 每个站点均随机文件名<br />
          　可选窗如果是红色, 表示数据太大, 不建议备份!<br />
          　备份文件为.sql结尾, 目前测试在phpmyadmin, sqlyog中均可直接恢复.<br />
           　浏览器中右键另存为, 请保存为.sql文件, PHPmyadmin导入大于100MB备份需要调整: wait_timeout/max_allowed_packet<br />
          
        </td>
    </tr>
</table>

</div>