SHARE
TWEET

Untitled

a guest Sep 4th, 2018 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // SETTING ALL EVENT LISTENERS
  2. username.addEventListener("keyup", usernameVerify, true);
  3. password.addEventListener('keyup', passwordVerify, true);
  4. submit.addEventListener("click", function(event) {
  5.   var username = document.getElementById("username");
  6.   var password = document.getElementById("password");
  7.   var submit = document.getElementById("submit");
  8.   var wrong = document.getElementById("wrong");
  9.   event.preventDefault();
  10.   $.ajax({
  11.     url: "checkdata.php",
  12.     type: "POST",
  13.     data: { login: username.value, password: password.value },
  14.     success: function(d) {
  15.       if (usernameVerify() && passwordVerify()) {
  16.         window.location.href='../panel/';
  17.       }
  18.       else {
  19.         wrong.innerHTML = d;
  20.         username.style.border = "2px solid #F46969";
  21.         username.style.boxShadow = "0px 0px 10px 4px #F46969";
  22.         username.style.outline = "none";
  23.         password.style.border = "2px solid #F46969";
  24.         password.style.boxShadow = "0px 0px 10px 4px #F46969";
  25.         password.style.outline = "none";
  26.       }
  27.     }
  28.   });
  29. });
  30.  
  31. function usernameVerify() {
  32.   // username
  33. var username = document.getElementById("username");
  34. var password = document.getElementById("password");
  35. var submit = document.getElementById("submit");
  36. var wrong = document.getElementById("wrong");
  37.   var str = username.value;
  38.   if (str == "") {
  39.     username.style.border = "2px solid #F46969";
  40.     username.style.boxShadow = "0px 0px 10px 4px #F46969";
  41.     username.style.outline = "none";
  42.     return false;
  43.   } else {
  44.     username.style.border = "none";
  45.     username.style.boxShadow = "none";
  46.     username.style.outline = "none";
  47.     return true;
  48.   }
  49. }
  50. //password
  51. function passwordVerify()
  52. {
  53. var username = document.getElementById("username");
  54. var password = document.getElementById("password");
  55. var submit = document.getElementById("submit");
  56. var wrong = document.getElementById("wrong");
  57.   var str = password.value;
  58.   if (str == "") {
  59.     password.style.border = "2px solid #F46969";
  60.     password.style.boxShadow = "0px 0px 10px 4px #F46969";
  61.     password.style.outline = "none";
  62.     return false;
  63.   } else {
  64.     password.style.border = "none";
  65.     password.style.boxShadow = "none";
  66.     password.style.outline = "none";
  67.     return true;
  68.   }
  69. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top