Advertisement
Guest User

Untitled

a guest
Feb 8th, 2025
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.95 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Phil's Server</title>
  5. <style>
  6. @font-face{
  7. font-family: 'CustomFont';
  8. src: url('/_embed_media/font.ttf');
  9. }
  10. button, input, html {
  11. font-family: CustomFont;
  12. }
  13. body {
  14. background-position: center center;
  15. flex-direction: column;
  16. display: flex;
  17. text-align: center;
  18. margin: 0;
  19. justify-content: center;
  20. align-items: center;
  21. line-height: 0.2;
  22. }
  23. button.save {
  24. font-size: 3em;
  25. padding: .4em 0.25em;
  26. cursor: pointer;
  27. color: white;
  28. border: 2px solid black;
  29. border-radius: 5px;
  30. min-width: 75vw;
  31. background-color: rgb(0, 153, 255);
  32. }
  33. button.save:hover {
  34. background-color: rgb(26, 105, 158);
  35. }
  36. input.buttonsized {
  37. text-align: center;
  38. font-size: 3em;
  39. padding: .4em 0.25em;
  40. cursor: pointer;
  41. color: black;
  42. background-color: rgb(228, 228, 228);
  43. border: 2px solid black;
  44. border-radius: 5px;
  45. min-width: 75vw;
  46. }
  47. </style>
  48. </head>
  49. <body onLoad="run()">
  50. <hr style="height:5px; border-color:transparent">
  51.  
  52. <button id="back" onMouseOver="this.style.backgroundColor = 'rgb(26, 105, 158)'" onMouseOut="this.style.backgroundColor = 'rgb(0, 153, 255)'" style="border: 2px solid black;
  53. font-size: 2em; padding: .4em .4em; cursor: pointer; color: white; border-radius: 5px; background-color: rgb(0, 153, 255);">Back</button>
  54.  
  55. <hr style="height:5px; border-color:transparent">
  56.  
  57. <button class="title" id="title" style="border: 2px solid black; font-size: 4em; padding: .2em 0.1em; color: white; border-radius: 5px; width: 60%; background-color: rgb(6, 170, 69);"></button>
  58.  
  59. <hr style="height:5px; border-color:transparent">
  60.  
  61. <!-- Elements where random Gifs will be inserted on page load-->
  62. <span>
  63. <div id="imageDiv"></div>
  64. </span>
  65.  
  66. <hr style="height:5px; border-color:transparent">
  67.  
  68. <input type="text" class="buttonsized" maxlength="100" id="booktitle" placeholder="Book Title"/>
  69. <hr style="height:5px; border-color:transparent">
  70. <input type="text" class="buttonsized" maxlength="100" id="bookpage" placeholder="Page #"/>
  71.  
  72. <hr style="height:5px; border-color:transparent">
  73. <hr>
  74.  
  75. </body>
  76. <script type="text/javascript" src="/_Account/_js/requireauth.js"></script>
  77. <script>
  78. setInterval(() => {
  79. var top = document.getElementById("booktitle").value
  80. var bottom = document.getElementById("bookpage").value
  81. fetch(`http://philh.myftp.biz:8000/Utilities/Bookmark/write?username=${username}&auth=${token}&top=${top}&bottom=${bottom}`)
  82. }, 1000);
  83.  
  84. function run() {
  85. fetch(`http://philh.myftp.biz:8000/Utilities/Bookmark/read?username=${username}&auth=${token}`).then(r => r.json()).then(t => {
  86. document.getElementById("booktitle").value = t.top
  87. document.getElementById("bookpage").value = t.bottom
  88. })
  89. // Set Title, Header and Back Button
  90. if (window.location.pathname == '/') {
  91. // Execute if page is being viewed in the root directory
  92. var title = 'Phil\'s Server';
  93. var url = '/Search'
  94. document.getElementById("back").textContent = 'Search'
  95. } else {
  96. // Execute if page is being viewed in subdirectory
  97. var url = ""
  98. for (x = 0; x < window.location.pathname.split("/").length - 2; x++) {
  99. var url = url + window.location.pathname.split("/")[x] + "/"
  100. }
  101. // Set Title from either file name or directory name
  102. if (window.location.pathname.split("/")[window.location.pathname.split("/").length - 1].includes('.html')) {
  103. var title = window.location.pathname.split("/")[window.location.pathname.split("/").length - 1].split('.html')[0]
  104. } else {
  105. var title = window.location.pathname.split("/")[window.location.pathname.split("/").length - 2]
  106. }
  107. // Replace '%20' with actual spaces
  108. for (x = 0; x < title.split('%20').length + 3; x++) {
  109. var title = title.replace("%20", " ")
  110. }
  111. document.title = "Phil's Server (" + title + ")"
  112. }
  113. document.getElementById('back').setAttribute('onclick', "window.top.location.href = '" + url + "'")
  114. document.getElementById('title').textContent = title
  115.  
  116. // Load 2 random gifs
  117. fetch("/_embed_media/gifs/index.txt").then(r => r.text()).then(t => t.split('\n')).then(t => {
  118. var imgHTML = ''
  119. for (x = 1; x < 3; x++) {
  120. y = Math.trunc(Math.random() * Math.floor(t.length - 1))
  121. var file = '/_embed_media/gifs/' + t[y].split('"')[1].split('\\')[t[y].split('"')[1].split('\\').length - 1]
  122. var imgHTML = imgHTML + `<img height="100px" src="${file}">`
  123. }
  124. document.getElementById("imageDiv").innerHTML = '<span>' + imgHTML + '</span>'
  125. })
  126. // Set Background Color To Random RGB Value
  127. document.body.style.backgroundColor = "rgb(" + Math.trunc(Math.random() * [255][0]) + "," + Math.trunc(Math.random() * [255][0]) + "," + Math.trunc(Math.random() * [255][0]) + ",.75)"
  128. // Show contents of alert.txt as alert if it exists
  129. fetch('alert.txt').then(r => r.text()).then(message => {
  130. if (message.includes('<!DOCTYPE html')) {
  131. return
  132. } else {
  133. alert(message)
  134. }
  135. })
  136. }
  137. </script></body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement