Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function login_timeout() {
  2.  
  3. $("#login-stats > p").html('SEEMS SOMETHING WENT WRONG!<br />Please try again later');
  4.  
  5. }
  6.  
  7. $(document).ready(function() {
  8.          $("#lbutton").click(function() {$('#login-stats').show('slow');});
  9.  
  10.  
  11.      
  12.     $('#loginform').submit(function() {
  13.  
  14.  
  15.         var errors = [];
  16.                        
  17.         var username = $("#username").val();
  18.         var password = $("#password").val();
  19.                        
  20.         if (username == "") {
  21.             errors.push("No username specified<br />");}
  22.  
  23.  
  24.         if (password == "") {
  25.             errors.push("No password specified<br />");
  26.         }
  27.                        
  28.         if(errors.length > 0) {
  29.             errors.unshift("<strong>Please check the following errors:</strong> <br />");
  30.             $("#login-stats > p").html(errors.join('* '));
  31.             return false;  
  32.            
  33.         } else {
  34.  
  35.            
  36.             $("#login-stats > p").html('<img src="images/logging.gif" width="64" height="64" align="left" /><strong>Please wait...</strong><br /><br />While we verify your username and password');
  37.            
  38.             var timeout = setTimeout('login_timeout()', 30000)
  39.    
  40.             $.post('checklogin.php', $("#loginform").serialize(), function(data) {                                                         
  41.                 if (data.match(/Invalid/i)) {
  42.  
  43.                     errors.push("<strong>Please check the following errors:</strong> <br />");
  44.                     errors.push(data);
  45.                     $('#login-stats').html(errors.join(''));
  46.                     clearTimeout(timeout);
  47.                    
  48.                 } else if (data.match('/OK/i')) {window.location = "index.html"; clearTimeout(timeout);}
  49.  
  50.             });
  51.         }
  52.  
  53. return false;  
  54.  
  55. });
  56.  
  57.  
  58.  
  59.  
  60. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement