Advertisement
Guest User

Untitled

a guest
Nov 13th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <meta charset="UTF-8">
  5. <title> Your sign in panel </title>
  6.  
  7. <style>
  8. input {
  9. margin: 10px;
  10. width: 100%;
  11. }
  12.  
  13. fieldset {
  14. width: 20%;
  15. min-width: 200px;
  16. min-height: 100px;
  17. margin: -5px;
  18. border-color: blue;
  19. }
  20.  
  21. div {
  22. color: royalblue;
  23. text-align:center;
  24. font-weight: bold;
  25. }
  26. </style>
  27. </head>
  28.  
  29. <body>
  30. <fieldset>
  31. <legend> Sign in here </legend>
  32.  
  33. Your username:
  34. <input type="text" name="username" id="username" required>
  35. <br> Your password:
  36. <input type="password" name="password" id="password" required>
  37. <br>
  38. <input type="button" value="sign in" onclick="signin()">
  39. <br>
  40. <div id="result"></div>
  41. </fieldset>
  42. </body>
  43.  
  44. </html>
  45.  
  46. <script>
  47. function signin() {
  48. var pass = document.getElementById('password');
  49. var usr = document.getElementById('username');
  50. var result_label = document.getElementById('result')
  51. var params = '?username=' + usr.value + '&' + 'password=' + pass.value;
  52.  
  53. const xhttp = new XMLHttpRequest();
  54.  
  55. xhttp.onreadystatechange = function () {
  56. if (this.readyState == 4 && this.status == 200) {
  57. if (this.responseText == '403') {
  58. result_label.innerHTML = 'You have entered wrong username or password;
  59. } else {
  60. result_label.innerHTML = 'You have connected successfully;
  61.  
  62. document.write(this.responseText);
  63. document.close();
  64. }
  65. }
  66.  
  67. }
  68. xhttp.open('GET', '/login' + params, true);
  69. xhttp.send();
  70.  
  71. }
  72. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement