index.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. require_once "../path.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. </div>
  33. </div>
  34. <div>上次更新时间:</div>
  35. <div id="sync_result">
  36. </div>
  37. </div>
  38. <script>
  39. let localhost;
  40. let base = "/app/sync/";
  41. let path="";
  42. if(location.pathname.indexOf(base)>=0){
  43. path = location.pathname.slice(0,location.pathname.indexOf(base));
  44. }
  45. localhost=location.protocol +"//"+ location.hostname + location.port + path;
  46. $("#sync_local_address").val(localhost);
  47. $(document).ready(function(){
  48. sync_index_init();
  49. });
  50. </script>
  51. <?php
  52. }
  53. ?>
  54. </body>
  55. </html>