access.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. $data = json_decode(file_get_contents("data.json"),true)[$_GET["sharingid"]];
  3. function formatSizeUnits($bytes){
  4. if ($bytes >= 1073741824){
  5. $bytes = number_format($bytes / 1073741824, 2) . ' GB';
  6. }elseif ($bytes >= 1048576){
  7. $bytes = number_format($bytes / 1048576, 2) . ' MB';
  8. }elseif ($bytes >= 1024){
  9. $bytes = number_format($bytes / 1024, 2) . ' KB';
  10. }elseif ($bytes > 1){
  11. $bytes = $bytes . ' bytes';
  12. }elseif ($bytes == 1){
  13. $bytes = $bytes . ' byte';
  14. }else{
  15. $bytes = '0 bytes';
  16. }
  17. return $bytes;
  18. }
  19. ?>
  20. <!DOCTYPE html>
  21. <meta name="apple-mobile-web-app-capable" content="yes" />
  22. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  23. <html>
  24. <head>
  25. <script type='text/javascript' charset='utf-8'>
  26. // Hides mobile browser's address bar when page is done loading.
  27. window.addEventListener('load', function(e) {
  28. setTimeout(function() { window.scrollTo(0, 1); }, 1);
  29. }, false);
  30. </script>
  31. <meta charset="UTF-8">
  32. <title>Quick Send</title>
  33. <link rel="stylesheet" href="../script/tocas/tocas.css">
  34. <style>
  35. .outer-div
  36. {
  37. display: table;
  38. position: absolute;
  39. height: 100%;
  40. width: 100%;
  41. }
  42. .mid-div
  43. {
  44. display: table-cell;
  45. vertical-align: middle;
  46. }
  47. .center-div
  48. {
  49. margin: 0 auto;
  50. width: 300px;
  51. height: 100px;
  52. }
  53. </style>
  54. </head>
  55. <body>
  56. <br>
  57. <div class="outer-div"><div class="mid-div"><div class="center-div">
  58. <div class="ts container" style="margin: auto;margin: auto;margin-top: 30vh;text-align: center">
  59. <div class="ts segment">
  60. <h3 class="ts center aligned icon header">
  61. <i id="icn" class="file outline icon"></i><?php echo pathinfo($data["path"],PATHINFO_BASENAME); ?>
  62. <div class="sub header"><?php echo formatSizeUnits(filesize($data["path"])); ?></div>
  63. </h3>
  64. <?php if(isset($data["password"])){ ?>
  65. <br>
  66. <div class="ts fluid input">
  67. <input id="pwd" type="password" placeholder="Verification Code">
  68. </div>
  69. <br>
  70. <?php } ?>
  71. <br>
  72. <button onclick="download()" class="ts fluid button">Download</button>
  73. <div>
  74. </div>
  75. </div></div></div>
  76. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
  77. <script src="../script/tocas/tocas.js"></script>
  78. <script src="../script/ao_module.js"></script>
  79. <script>
  80. var sharingid = "<?php echo $_GET["sharingid"]; ?>";
  81. var ext = ao_module_utils.getIconFromExt("<?php echo pathinfo($data["path"],PATHINFO_EXTENSION) ?>");
  82. $("#icn").attr("class",ext + " icon");
  83. function download(){
  84. if($("#pwd").length){
  85. $.get( "download.php?sharingid=" + sharingid + "&chkpassword=" + $("#pwd").val(), function( data ) {
  86. if(data){
  87. window.location = "download.php?sharingid=" + sharingid + "&password=" + $("#pwd").val();
  88. }else{
  89. console.log("Incorrect");
  90. }
  91. });
  92. }else{
  93. window.location = "download.php?sharingid=" + sharingid;
  94. }
  95. }
  96. var lan = JSON.parse('{"zh-TW":{"%n KB":"%n千位元組","%n MB":"%n百萬位元組","%n GB":"%n吉位元組","%n TB":"%n兆位元組","%n PB":"%n拍位元組","%n EB":"%n艾位元組","%n ZB":"%n皆位元組","%n YB":"%n佑位元組","Verification Code":"驗證碼","Download":"下載"},"en-US":{"%nKB":"%nKiloByte","%nMB":"%nMegaByte","%nGB":"%nGigaByte","%nTB":"%nTeraByte","%nPB":"%nPetaByte","%nEB":"%nExaByte","%nZB":"%nZettaByte","%nYB":"%nYottaByte","Verification Code":"Verification Code","Download":"Download"}}');
  97. </script>
  98. <script src="i18n.js"></script>
  99. </body>
  100. </html>