@($fp = fopen($bakfile, "r")); @flock($fp, 3); $sqldump = @fread($fp, filesize($bakfile)); @fclose($fp); } @($bakidentify = explode(',', base64_decode(preg_replace("/^# Identify:\\s*(\\w+).*/s", "\\1", substr($sqldump, 0, 256))))); if (!defined('IN_DISCUZ')) { define('IN_DISCUZ', TRUE); } include_once TDISCUZ_ROOT . '/source/discuz_version.php'; if ($bakidentify[1] != DISCUZ_VERSION) { show_msg('备份文件版本错误,不能恢复。'); } $vol = $bakidentify[4]; $nextfile = taddslashes(str_replace("-{$vol}.sql", "-" . ($vol + 1) . '.sql', $bakfile)); $result = $t->db_runquery($sqldump); if ($result) { show_msg('正在恢复分卷:' . $vol, "tools.php?action={$action}&nextfile={$nextfile}", 2000); } } $t->close_db(); show_header(); print <<<END \t\t<div class="bm"> \t\t<form action="tools.php?action={$action}" method="post"> \t\t<table class="tdat"><tbody> \t\t<tr class=\\'alt h\\'><th>备份项目</th><th>版本</th><th>时间</th><th>类型</th><th>文件总数</th><th>导入</th></tr> END; foreach ($exportlog as $value) { echo '<tr><td>' . $value['filename'] . '</td><td>' . $value['version'] . '</td><td>' . $value['dateline'] . '</td><td>' . $value['method'] . '</td><td>' . $value['volume'] . '</td><td><a href="tools.php?action=' . $action . '&detail=' . $value['filename'] . '"><font color="blue">打开</font></a></td></tr>'; }