<?php require dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/global.php'; global $db_config, $db, $config; @(require 'config.php'); include APP_PATH . '/app/include/dbbackup/class/functions.php'; $editor = 2; $mydbname = $db_config['dbname']; $mypath = $_GET['mypath']; SetCharset($db_config['charset']); $usql = $db->query("use `{$mydbname}`");
function BackupDatabaseRecordNum($t, $s, $p, $mypath, $alltotal, $thenof, $fnum, $auf = '', $aufval = 0, $stime = 0) { global $db, $bakpath, $limittype, $fun_r, $adminDir; if (empty($mypath)) { } $path = PLUS_PATH . '/bdata/' . $mypath; @(include $path . "/config.php"); if (empty($b_table)) { } $waitbaktime = (int) $_GET['waitbaktime']; if (empty($stime)) { $stime = time(); } $header = "<?php\r\nrequire(LIB_PATH.\"dbbackup/inc/header.php\");\r\n"; $footer = "\r\nrequire(LIB_PATH.\"dbbackup/inc/footer.php\");\r\n?>"; $btb = explode(",", $b_table); $count = count($btb); $t = (int) $t; $s = (int) $s; $p = (int) $p; if ($t >= $count) { echo "<script>alert('" . $fun_r['BakSuccess'] . "\\n\\n" . $fun_r['TotalUseTime'] . ToChangeUseTime($stime) . "');self.location.href='" . $config['sy_weburl'] . "/" . $adminDir . "/index.php?m=database';</script>"; exit; } $u = $db->query("use `{$b_dbname}`"); if ($b_dbchar == 'auto') { if (!empty($s)) { $status_r = GetTableRows($b_dbname, $btb[$t]); $collation = GetCharset($status_r['Collation']); SetCharset($collation); $num = $limittype ? -1 : $status_r['Rows']; } else { $collation = $_GET['collation']; SetCharset($collation); $num = (int) $alltotal; } $dumpsql .= ExcuteSetCharset($collation); } else { SetCharset($b_dbchar); if (!empty($s)) { if ($limittype) { $num = -1; } else { $status_r = GetTableRows($b_dbname, $btb[$t]); $num = $status_r['Rows']; } } else { $num = (int) $alltotal; } } if ($b_stru && $s) { $dumpsql .= GetTableStructSql($btb[$t], $b_strufour); } if (empty($fnum)) { $return_fr = GetTableFields($b_dbname, $btb[$t], $b_autofield); $fieldnum = $return_fr['num']; $noautof = $return_fr['autof']; $auf = $return_fr['auf']; } else { $fieldnum = $fnum; $noautof = $thenof; } $aufval = (int) $aufval; if ($b_autoauf == 1 && $auf) { $sql = $db->query("select * from `" . $btb[$t] . "` where " . $auf . ">" . $aufval . " order by " . $auf . " limit {$b_bakline}"); } else { $sql = $db->query("select * from `" . $btb[$t] . "` limit {$s},{$b_bakline}"); } $inf = ''; if ($b_beover == 1) { $inf = '(' . GetTableInsertFields($b_dbname, $btb[$t]) . ')'; } $hexf = ''; if ($b_bakdatatype == 1) { $hexf = GetTableStringFields($b_dbname, $btb[$t]); } $b = 0; while ($r = $db->fetch($sql)) { if ($auf) { $lastaufval = $r[$auf]; } $b = 1; $s++; $dumpsql .= "ExcuteSQL(\"into `" . $btb[$t] . "`" . $inf . " values("; $first = 1; for ($i = 0; $i < $fieldnum; $i++) { if (empty($first)) { $dumpsql .= ','; } else { $first = 0; } $myi = $i + 1; if (!isset($r[$i]) || strstr($noautof, ',' . $myi . ',')) { $dumpsql .= 'NULL'; } else { $dumpsql .= GetFieldContent($r[$i], $b_bakdatatype, $myi, $hexf); } } $dumpsql .= ");\");\r\n"; } if (empty($b)) { if (empty($p)) { $p++; $sfile = $path . "/" . $btb[$t] . "_" . $p . ".php"; $dumpsql = $header . $dumpsql . $footer; WriteString2File($sfile, $dumpsql); } FetchFileNumber($p, $btb[$t], $path); $t++; $db->free($sql); echo "<meta http-equiv=\"refresh\" content=\"" . $waitbaktime . ";url=" . $config['sy_weburl'] . "/" . $adminDir . "/index.php?m=database&c=BackupDatabaseRecordNum&s=0&p=0&t={$t}&mypath={$mypath}&stime={$stime}&waitbaktime={$waitbaktime}\">" . $fun_r['OneTableBakSuccOne'] . $btb[$t - 1] . $fun_r['OneTableBakSuccTwo']; exit; } $p++; $sfile = $path . "/" . $btb[$t] . "_" . $p . ".php"; $dumpsql = $header . $dumpsql . $footer; WriteString2File($sfile, $dumpsql); $db->free($sql); echo "<meta http-equiv=\"refresh\" content=\"" . $waitbaktime . ";url=" . $config['sy_weburl'] . "/" . $adminDir . "/index.php?m=database&c=BackupDatabaseRecordNum&s={$s}&p={$p}&t={$t}&mypath={$mypath}&alltotal={$num}&thenof={$noautof}&fieldnum={$fieldnum}&auf={$auf}&aufval={$lastaufval}&stime={$stime}&waitbaktime={$waitbaktime}&collation={$collation}\">" . $fun_r['BakOneDataSuccess'] . EchoBackupProcesser($btb[$t], $count, $t, $num, $s); exit; }