国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
7.8KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  6. <title>数据备份</title>
  7. <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
  8. <link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="/static/web/css/admin.css">
  10. <script src="/static/web/js/jquery.min.js"></script>
  11. <script src="/static/web/js/bootstrap.min.js"></script>
  12. <script src="/static/web/js/webajax.js"></script>
  13. <script src="/static/web/js/admin.main.js"></script>
  14. </head>
  15. <body>
  16. <ol class="breadcrumb">
  17. <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li>
  18. <li class="breadcrumb-item active">数据备份</li>
  19. </ol>
  20. <div class="card shadow-sm mb-3">
  21. <div class="card-body">
  22. <a href="sys_data_revert.php" class="btn btn-success btn-sm">数据还原</a>
  23. <a href="sys_sql_query.php" class="btn btn-success btn-sm">SQL命令工具</a>
  24. </div>
  25. </div>
  26. <div class="card shadow-sm">
  27. <div class="card-header">数据备份</div>
  28. <div class="card-body">
  29. <form name="form1" action="sys_data_done.php?dopost=bak" method="post" target="stafrm" onSubmit="checkSubmit();">
  30. <input type="hidden" name="tablearr">
  31. <div class="table-responsive">
  32. <table class="table table-borderless">
  33. <thead>
  34. <tr>
  35. <td colspan="8">系统默认表</td>
  36. </tr>
  37. <tr>
  38. <td scope="col">选择</td>
  39. <td scope="col">表名</td>
  40. <td scope="col">记录数</td>
  41. <td scope="col">操作</td>
  42. <td scope="col">选择</td>
  43. <td scope="col">表名</td>
  44. <td scope="col">记录数</td>
  45. <td scope="col">操作</td>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. <?php
  50. for ($i=0; isset($dedeSysTables[$i]); $i++)
  51. {
  52. $t = $dedeSysTables[$i];
  53. echo "<tr>";
  54. ?>
  55. <td><input type="checkbox" name="tables" value="<?php echo $t;?>" checked></td>
  56. <td><?php echo $t;?></td>
  57. <td><?php echo TjCount($t,$dsql);?></td>
  58. <td>
  59. <a href="javascript:LoadUrl('dopost=opimize&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">优化</a>
  60. <a href="javascript:LoadUrl('dopost=repair&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">修复</a>
  61. <a href="javascript:LoadUrl('dopost=viewinfo&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">结构</a>
  62. </td>
  63. <?php
  64. $i++;
  65. if (isset($dedeSysTables[$i])) {
  66. $t = $dedeSysTables[$i];
  67. ?>
  68. <td><input type="checkbox" name="tables" value="<?php echo $t;?>" checked></td>
  69. <td><?php echo $t;?></td>
  70. <td><?php echo TjCount($t,$dsql);?></td>
  71. <td>
  72. <a href="javascript:LoadUrl('dopost=opimize&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">优化</a>
  73. <a href="javascript:LoadUrl('dopost=repair&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">修复</a>
  74. <a href="javascript:LoadUrl('dopost=viewinfo&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">结构</a>
  75. </td>
  76. <?php
  77. } else {
  78. echo "<td></td><td></td><td></td><td></td>";
  79. }
  80. echo "</tr>";
  81. }
  82. ?>
  83. </tbody>
  84. <thead>
  85. <tr>
  86. <td colspan="8">其他数据表</td>
  87. </tr>
  88. <tr>
  89. <td scope="col">选择</td>
  90. <td scope="col">表名</td>
  91. <td scope="col">记录数</td>
  92. <td scope="col">操作</td>
  93. <td scope="col">选择</td>
  94. <td scope="col">表名</td>
  95. <td scope="col">记录数</td>
  96. <td scope="col">操作</td>
  97. </tr>
  98. </thead>
  99. <tbody>
  100. <?php
  101. for ($i=0; isset($otherTables[$i]); $i++)
  102. {
  103. $t = $otherTables[$i];
  104. echo "<tr>";
  105. ?>
  106. <td><input type="checkbox" name="tables" value="<?php echo $t;?>"></td>
  107. <td><?php echo $t;?></td>
  108. <td><?php echo TjCount($t,$dsql);?></td>
  109. <td>
  110. <a href="javascript:LoadUrl('dopost=opimize&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">优化</a>
  111. <a href="javascript:LoadUrl('dopost=repair&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">修复</a>
  112. <a href="javascript:LoadUrl('dopost=viewinfo&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">结构</a>
  113. </td>
  114. <?php
  115. $i++;
  116. if (isset($otherTables[$i])) {
  117. $t = $otherTables[$i];
  118. ?>
  119. <td><input type="checkbox" name="tables" value="<?php echo $t;?>"></td>
  120. <td><?php echo $t;?></td>
  121. <td><?php echo TjCount($t,$dsql);?></td>
  122. <td>
  123. <a href="javascript:LoadUrl('dopost=opimize&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">优化</a>
  124. <a href="javascript:LoadUrl('dopost=repair&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">修复</a>
  125. <a href="javascript:LoadUrl('dopost=viewinfo&tablename=<?php echo $t;?>');" class="btn btn-light btn-sm">结构</a>
  126. </td>
  127. <?php
  128. } else {
  129. echo "<td></td><td></td><td></td><td></td>";
  130. }
  131. echo "</tr>";
  132. }
  133. ?>
  134. <tr>
  135. <td colspan="8">
  136. <label>分卷大小:<input name="fsize" type="text" id="fsize" value="2048" class="admin-input-sm"> K</label>
  137. <label><input type="checkbox" name="isstruct" id="isstruct" value="1" checked> 备份结构</label>
  138. <?php if (@function_exists('gzcompress') && false) {?>
  139. <label><input type="checkbox" name="iszip" id="iszip" value="1" checked> 完成后压缩成ZIP</label>
  140. <?php }?>
  141. <a href="javascript:SelAll();" class="btn btn-success btn-sm">全选</a>
  142. <a href="javascript:ReSel();" class="btn btn-success btn-sm">反选</a>
  143. <a href="javascript:NoneSel();" class="btn btn-success btn-sm">取消</a>
  144. <button type="submit" class="btn btn-success btn-sm">备份</button>
  145. </td>
  146. </tr>
  147. <tr>
  148. <td colspan="8">
  149. <div class="admin-win-iframe"><iframe name="stafrm" frameborder="0" id="stafrm" width="100%" height="100%"></iframe></div>
  150. </td>
  151. </tr>
  152. </tbody>
  153. </table>
  154. </div>
  155. </form>
  156. </div>
  157. </div>
  158. <script>
  159. var posLeft = 200;
  160. var posTop = 150;
  161. function LoadUrl(surl) {
  162. fetch("sys_data.php?" + surl).then(resp => {
  163. if (resp.ok) {
  164. return resp.text()
  165. }
  166. throw new Error('x');
  167. }).then((d) => {
  168. ShowMsg(d, {
  169. size: "modal-lg"
  170. });
  171. }).catch((error) => {
  172. ShowMsg("操作失败");
  173. });
  174. }
  175. //获得选中文件的数据表
  176. function getCheckboxItem() {
  177. var myform = document.form1;
  178. var allSel = '';
  179. if (myform.tables.value) return myform.tables.value;
  180. for (i = 0; i < myform.tables.length; i++) {
  181. if (myform.tables[i].checked) {
  182. if (allSel == "")
  183. allSel = myform.tables[i].value;
  184. else
  185. allSel = allSel + "," + myform.tables[i].value;
  186. }
  187. }
  188. return allSel;
  189. }
  190. //反选
  191. function ReSel() {
  192. var myform = document.form1;
  193. for (i = 0; i < myform.tables.length; i++) {
  194. if (myform.tables[i].checked) myform.tables[i].checked = false;
  195. else myform.tables[i].checked = true;
  196. }
  197. }
  198. //全选
  199. function SelAll() {
  200. var myform = document.form1;
  201. for (i = 0; i < myform.tables.length; i++) {
  202. myform.tables[i].checked = true;
  203. }
  204. }
  205. //取消
  206. function NoneSel() {
  207. var myform = document.form1;
  208. for (i = 0; i < myform.tables.length; i++) {
  209. myform.tables[i].checked = false;
  210. }
  211. }
  212. function checkSubmit() {
  213. var myform = document.form1;
  214. myform.tablearr.value = getCheckboxItem();
  215. return true;
  216. }
  217. </script>
  218. </body>
  219. </html>