Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function signIn() {
- $("#login_error").html("");
- $("#login_username_error").html("");
- $("#login_password_error").html("");
- if (clear_spaces($("#login_username").val()) == "")
- $("#login_username_error").html("Enter Username");
- else if (clear_spaces($("#login_password").val()) == "")
- $("#login_password_error").html("Enter Password");
- else {
- $.ajax({
- type: 'POST',
- url: "php/ajax.php",
- data: "function=login&login_username=" + $("#login_username").val() + "&login_password=" + $("#login_password").val() + "&login_remember=" + (($("#login_remember").is(':checked')) ? 1 : 0),
- success: function(data) {
- if (data && data.success)
- {
- phpsessid = data.phpsessid;
- location.replace(getServerPath());
- }
- else
- {
- switch (data.reason)
- {
- case "wrong":
- $("#login_error").html("Username/Password incorrect. Please try again.");
- break;
- case "empty":
- $("#login_error").html("Please fill in all the details.");
- break;
- case "blocked":
- $("#login_error").html("Your account is blocked.");
- break;
- default:
- $("#login_error").html("Error logging in. Please try again.");
- }
- }
- },error: function() {$("#login_error").html("Username/Password incorrect. Please try again.");},
- dataType: "json"
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement