<?php

require_once 'init.php';
if ($_POST['params']) {
    $dbUnique = $_POST['u'];
    $dbConfig = getConfigByUnique($dbUnique);
    importClass('DB_Factory');
    $dbFac = new DB_Factory($dbConfig);
    $bakDir = 'e:/0501';
    $bakFileSize = 2024;
    list($startRow, $goOn, $tableId, $fileId, $loop, $bakFixPrefix) = explode('|', $_POST['params']);
    $bakTables = explode('|', trim($_POST['tables'], '|'));
    $dbBak = $dbFac->getBackup($bakDir, $bakFileSize, $bakTables, $bakFixPrefix);
    $result = $dbBak->begin($startRow, $goOn, $tableId, $fileId, $loop);
    if ($result === true) {
        exit('succ');
    } else {
        exit(implode('|', $result));
    }
} else {
    $dbUnique = $_GET['u'];
    $dict = getDictByConfig($dbUnique);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<?php 
echo URL;
?>
"  />