2
0

index.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. require_once "../config.php";
  3. require_once "../public/load_lang.php";
  4. require_once "../pcdl/html_head.php";
  5. ?>
  6. <body class="sync_body">
  7. <script language="javascript" src="sync.js"></script>
  8. <?php
  9. if(!isset($_COOKIE["userid"])){
  10. echo "没有登录,请在登录后执行同步操作";
  11. }
  12. else if(!isset($_COOKIE["sync_userid"])){
  13. ?>
  14. <h3>等在跳转到登录页面</h3>
  15. <script>
  16. window.location.assign("check_login.php");
  17. </script>
  18. <?php
  19. }
  20. else{
  21. ?>
  22. <div class="fun_block" style="margin-left: auto;margin-right: auto;max-width: 100%;">
  23. <h2>Sync</h2>
  24. <div id="wiki_search" style="width:100%;">
  25. <div>
  26. <h3>Server Address</h3>
  27. <input id="sync_server_address" type="input" readonly value="<?php echo $_COOKIE["sync_server"];?>" style="width:30em;" />
  28. <h3>Local Address</h3>
  29. <input id="sync_local_address" type="input" placeholder="local address" value="" style="width:30em;" />
  30. <button onclick="sync_pull()">pull</button>
  31. <button onclick="sync_push()">push</button>
  32. <button onclick="sync_stop()">stop</button>
  33. </div>
  34. </div>
  35. <div>上次更新时间:</div>
  36. <div id="sync_result"></div>
  37. <div id="sync_log"></div>
  38. </div>
  39. <script>
  40. let localhost;
  41. let base = "/app/sync/";
  42. let path="";
  43. if(location.pathname.indexOf(base)>=0){
  44. path = location.pathname.slice(0,location.pathname.indexOf(base));
  45. }
  46. localhost=location.protocol +"//"+ location.hostname + location.port + path;
  47. $("#sync_local_address").val(localhost);
  48. $(document).ready(function(){
  49. sync_index_init();
  50. });
  51. </script>
  52. <?php
  53. }
  54. ?>
  55. </body>
  56. </html>