function create_record($zone, $input) { $record = make_record($zone, $input); $records = get_records_by_name_type($zone, $record['name'], $record['type']); array_push($records, $record); $patch = array('rrsets' => array(array('name' => $record['name'], 'type' => $record['type'], 'changetype' => 'REPLACE', 'records' => $records))); api_request($zone['url'], $patch, 'PATCH'); return $record; }
exit; } } else { //分卷备份 if (!$_POST['filesize']) { $msgs = "请填写备份文件分卷大小"; echo jsalert($msgs, "backup.php"); exit; } $sql = make_header($_POST['tablename']); $p = 1; $filename = date("Ymd", time()) . "_" . $_POST['tablename']; $db->query("select * from " . $_POST['tablename']); $num_fields = $db->nf(); while ($db->nextrecord()) { $sql .= make_record($_POST['tablename'], $num_fields); if (strlen($sql) >= $_POST['filesize'] * 1000) { $filename .= "_v" . $p . ".sql"; if (write_file($sql, $filename)) { $msgs = "表-" . $_POST['tablename'] . "-卷-" . $p . "-数据备份完成,生成备份文件./backup/{$filename}"; } else { $msgs = "备份表-" . $_POST['tablename'] . "-失败"; } $p++; $filename = date("Ymd", time()) . "_" . $_POST['tablename']; $sql = ""; } } } if ($sql != "") { $filename .= "_v" . $p . ".sql";