Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. function signIn() {
  2. $("#login_error").html("");
  3. $("#login_username_error").html("");
  4. $("#login_password_error").html("");
  5. if (clear_spaces($("#login_username").val()) == "")
  6. $("#login_username_error").html("Enter Username");
  7. else if (clear_spaces($("#login_password").val()) == "")
  8. $("#login_password_error").html("Enter Password");
  9. else {
  10. $.ajax({
  11. type: 'POST',
  12. url: "php/ajax.php",
  13. data: "function=login&login_username=" + $("#login_username").val() + "&login_password=" + $("#login_password").val() + "&login_remember=" + (($("#login_remember").is(':checked')) ? 1 : 0),
  14. success: function(data) {
  15. if (data && data.success)
  16. {
  17. phpsessid = data.phpsessid;
  18. location.replace(getServerPath());
  19. }
  20. else
  21. {
  22. switch (data.reason)
  23. {
  24. case "wrong":
  25. $("#login_error").html("Username/Password incorrect. Please try again.");
  26. break;
  27. case "empty":
  28. $("#login_error").html("Please fill in all the details.");
  29. break;
  30. case "blocked":
  31. $("#login_error").html("Your account is blocked.");
  32. break;
  33. default:
  34. $("#login_error").html("Error logging in. Please try again.");
  35. }
  36.  
  37. }
  38. },error: function() {$("#login_error").html("Username/Password incorrect. Please try again.");},
  39. dataType: "json"
  40. });
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement