Advertisement
Guest User

createopeator

a guest
Feb 18th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.63 KB | None | 0 0
  1. <html>
  2. //css below is used to style the page
  3. <style>
  4.  
  5. <style>
  6. body {
  7. background-color: white;
  8. }
  9.  
  10. .menuBar {
  11. background-color: #fcd8a1;
  12. border-color: #fcd8a1;
  13. position: fixed;
  14. top: 0px;
  15. left: 0px;
  16. width: 100%;
  17. }
  18.  
  19. .menuBar a {
  20. float: right;
  21. color: black;
  22. text-align: center;
  23. padding: 16px 16px;
  24. text-decoration: none;
  25. font-size: 32;
  26. font-family: Tahoma;
  27. }
  28.  
  29. .menuBar a:hover, .dropBtn:hover {
  30. background-color: #ffcd11;
  31. color: white;
  32. }
  33.  
  34. .menuBar b {
  35. float: left;
  36. color: black;
  37. text-align: center;
  38. padding: 16px 16px;
  39. text-decoration: none;
  40. font-size: 32;
  41. font-family: Tahoma;
  42. }
  43.  
  44. .dropBtn {
  45. background-color: #fcd8a1;
  46. border:none;
  47. color: black;
  48. text-align: center;
  49. font-family: Tahoma;
  50. font-size: 32px;
  51. padding: 16px;
  52. }
  53.  
  54.  
  55. .dropBtn:hover, .dropBtn:focus {
  56. background-color: #ffcd11;
  57. }
  58.  
  59. .dropdown {
  60. position: relative;
  61. display: inline-block;
  62. float: right;
  63. }
  64.  
  65. .dropdownContent {
  66. display: none;
  67. position: absolute;
  68. background-color: #fcd8a1;
  69. min-width: 100px;
  70. overflow: auto;
  71. box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  72. background-color: #ffcd11;
  73. z-index: 1;
  74. }
  75.  
  76. .dropdownContent a {
  77. color: black;
  78. text-decoration: none;
  79. background-color: #fcd8a1;
  80. display: block;
  81. }
  82.  
  83. .dropdown a:hover {
  84. background-color: #ffcd11;
  85. }
  86.  
  87. .box {
  88. height: 240px;
  89. width: 33%;
  90. background-color: #FFFFFF;
  91. border:1px solid black;
  92. font-family: Tahoma;
  93. position: absolute;
  94. left: 33%;
  95. top: 20%;
  96. border-radius: 12px;
  97. }
  98.  
  99. .gap {
  100. height: 20px;
  101. }
  102.  
  103. .gap2 {
  104. height: 10px;
  105. }
  106.  
  107. .createBtn {
  108. position: absolute;
  109. right: -0px;
  110. bottom: -30px;
  111. padding-bottom: 0px;
  112. height = 20px;
  113. width = 80px;
  114. font-family: Tahoma;
  115. background-color: #fcd8a1;
  116. color: black;
  117. padding: 5px 15px;
  118. text-align: center;
  119. font-size: 10pt;
  120. cursor: pointer;
  121. border:1px solid black;
  122. border-radius: 12px;
  123. }
  124.  
  125. .button2:hover {
  126. color: #fcd8a1;
  127. }
  128.  
  129. #createOperator label {
  130. margin-left: 3%;
  131. display: inline-block;
  132. width: 150px;
  133. }
  134.  
  135. #firstName, #lastName, #username, #password, #confirm {
  136. width: 58%;
  137. margin-left: 5px;
  138. box-sizing: border-box;
  139. border: none;
  140. border-bottom: 2px solid #fcd8a1;
  141. font-family: Tahoma;
  142. }
  143.  
  144. .show {display: block;}
  145.  
  146. .timestamp {
  147. text-align: right;
  148. font-size: 32;
  149. position: fixed;
  150. right: 5px;
  151. top: 5px;
  152. font-family: Tahoma;
  153. }
  154.  
  155. .fontSizeButton {
  156.  
  157. background-color: #fcd8a1;
  158. border:none;
  159. color: black;
  160. text-align: center;
  161. font-family: Tahoma;
  162. font-size: 32px;
  163. padding: 16px;
  164.  
  165. }
  166. .fontSizeButton:hover {
  167. background-color: #ffcd11;
  168. }
  169.  
  170. </style>
  171.  
  172. <script>
  173.  
  174. var increasetrue = true;
  175. //boolean variable for detecting if font is big or normal
  176.  
  177. function increaseFontSize() {
  178.  
  179. if (increasetrue == true) {
  180. //if font is increased, makes elements of the page larger
  181. document.getElementById("fontSizeButton").innerHTML = "aA&#818";
  182. document.getElementById("boxDiv").style.height = "300px";
  183.  
  184.  
  185. document.getElementById("firstNameLabel").style.fontSize = "18pt";
  186. document.getElementById("lastNameLabel").style.fontSize = "18pt";
  187. document.getElementById("usernameLabel").style.fontSize = "18pt";
  188. document.getElementById("passwordLabel").style.fontSize = "18pt";
  189. document.getElementById("confirmPasswordLabel").style.fontSize = "18pt";
  190.  
  191. document.getElementById("firstName").style.fontSize = "18pt";
  192. document.getElementById("lastName").style.fontSize = "18pt";
  193. document.getElementById("username").style.fontSize = "18pt";
  194. document.getElementById("password").style.fontSize = "18pt";
  195. document.getElementById("confirm").style.fontSize = "18pt";
  196.  
  197. document.getElementById("submitButton").style.fontSize = "16pt";
  198. document.getElementById("submitButton").style.bottom = "-40px";
  199.  
  200. increasetrue = false;
  201.  
  202.  
  203. } else if (increasetrue == false) {
  204. //if font is decreased, makes elements of the page normal size
  205. document.getElementById("fontSizeButton").innerHTML = "a&#818A";
  206.  
  207. document.getElementById("boxDiv").style.height = "240px";
  208.  
  209.  
  210. document.getElementById("firstNameLabel").style.fontSize = "12pt";
  211. document.getElementById("lastNameLabel").style.fontSize = "12pt";
  212. document.getElementById("usernameLabel").style.fontSize = "12pt";
  213. document.getElementById("passwordLabel").style.fontSize = "12pt";
  214. document.getElementById("confirmPasswordLabel").style.fontSize = "12pt";
  215.  
  216. document.getElementById("firstName").style.fontSize = "12pt";
  217. document.getElementById("lastName").style.fontSize = "12pt";
  218. document.getElementById("username").style.fontSize = "12pt";
  219. document.getElementById("password").style.fontSize = "12pt";
  220. document.getElementById("confirm").style.fontSize = "12pt";
  221.  
  222. document.getElementById("submitButton").style.fontSize = "10pt";
  223. document.getElementById("submitButton").style.bottom = "-30px";
  224. increasetrue = true;
  225.  
  226. }
  227. }
  228.  
  229. function startTime() {
  230. var today = new Date();
  231. var h = today.getHours();
  232. var m = today.getMinutes();
  233. h = checkTime(h);
  234. m = checkTime(m);
  235. document.getElementById('timestamp').innerHTML =
  236. "<?php echo explode(",",$_COOKIE['operatorCookie'])[1] ?>" + " - " + h + ":" + m ;
  237. var t = setTimeout(startTime, 500);
  238. }
  239.  
  240. function checkTime(i) {
  241. if (i < 10) {i = "0" + i}
  242. return i;
  243. }
  244.  
  245. //Function that ensures that passwords match, the username does not already exist and that a password has been entered
  246. function operatorSubmit(){
  247.  
  248. var alreadyExists = false;
  249. var username = document.getElementById('username').value;
  250. var password = document.getElementById('password').value;
  251. var confirm = document.getElementById('confirm').value;
  252. var firstName = document.getElementById('firstName').value;
  253. var lastName = document.getElementById('lastName').value;
  254.  
  255. @foreach($operators as $key => $data)
  256. if("{{$data->username}}"==username){
  257. alreadyExists = true;
  258. }
  259. @endforeach
  260.  
  261. if((password === confirm) && alreadyExists===false && !(password === "" || confirm === "") && !(firstName === "" || lastName === "")){
  262. document.getElementById('createOperator').submit();
  263. }
  264. else if(firstName === "" || lastName === ""){
  265. alert('Please enter a first and last name');
  266. }
  267. else if(alreadyExists===true){
  268. alert('This username already exists');
  269. }
  270. else if(password === "" || confirm === ""){
  271. alert('Please ensure the new password has been entered twice');
  272. }
  273. else{
  274. alert('Passwords do not match');
  275. }
  276. }
  277.  
  278. </script>
  279.  
  280. <head>
  281. <title>Create Account</title>
  282. </head>
  283.  
  284. <body onload="startTime()">
  285.  
  286. <div id="menuBar" class="menuBar">
  287. //div for menu bar at the top
  288. <b style="float: left;">Make-It-All</b>
  289. <div class="dropdown">
  290. <b style="font-weight:normal" id="timestamp"></b>
  291. </div>
  292. <div class="dropdown">
  293. <button onclick="problemDropdown()" class="dropBtn">Menu</button>
  294. <div id="problemDropdown" class="dropdownContent">
  295. <a href="/addproblem">New Problem</a>
  296. <a href="/loadproblem">Load Problem</a>
  297. <a href="/createaccount">Create Account</a>
  298. <a href="/login">Logout</a>
  299. </div>
  300. </div>
  301. <div>
  302. <button id="fontSizeButton" type="submit" class="fontSizeButton" onclick="increaseFontSize()" >a&#818A</button>
  303. </div>
  304. </div>
  305.  
  306. <div id="boxDiv"class="box">
  307. //divs and buttons for the info box of the page where users can input data
  308. <form id="createOperator" action="" method="POST">
  309. @csrf
  310. <div class="gap"></div>
  311. <label id="firstNameLabel" for="firstName">First Name:</label>
  312. <input type="text" id="firstName" name="firstName">
  313. <div class="gap"></div>
  314. <label id="lastNameLabel" for="lastName">Last Name:</label>
  315. <input type="text" id="lastName" name="lastName">
  316. <div class="gap"></div>
  317. <label id="usernameLabel" for="username">Username:</label>
  318. <input type="text" id="username" name="username">
  319. <div class="gap"></div>
  320. <label id="passwordLabel" for="password">Password:</label>
  321. <input type="password" id="password" name="password">
  322. <div class="gap"></div>
  323. <label id="confirmPasswordLabel" for="confirm">Confirm Password:</label>
  324. <input type="password" id="confirm" name="confirm">
  325. </form>
  326. <button id="submitButton" onclick="operatorSubmit()" class="createBtn">Create</button>
  327. </div>
  328.  
  329. <script>
  330. /* When the user clicks on the button,
  331. toggle between hiding and showing the dropdown content */
  332. function problemDropdown() {
  333. document.getElementById("problemDropdown").classList.toggle("show");
  334. }
  335.  
  336. function userDropdown() {
  337. document.getElementById("userDropdown").classList.toggle("show");
  338. }
  339.  
  340. // Close the dropdown if the user clicks outside of it
  341. window.onclick = function(event) {
  342. if (!event.target.matches('.dropBtn')) {
  343. var dropdowns = document.getElementsByClassName("dropdownContent");
  344. var i;
  345. for (i = 0; i < dropdowns.length; i++) {
  346. var openDropdown = dropdowns[i];
  347. if (openDropdown.classList.contains('show')) {
  348. openDropdown.classList.remove('show');
  349. }
  350. }
  351. }
  352. }
  353. </script>
  354.  
  355. </body>
  356. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement