Last active
March 13, 2017 02:24
-
-
Save 4815162342/2cc90cf30748b2da54a2e4ae4e7d1a18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createAccount(){ | |
var email = $("#email").val(); | |
var password = $("#password").val(); | |
$("#email").removeClass("input-error"); | |
$("#password").removeClass("input-error"); | |
var input_error = false; | |
if(!email){ | |
$("#email").addClass("input-error"); | |
input_error = true; | |
} | |
if(!password){ | |
$("#password").addClass("input-error"); | |
input_error = true; | |
} | |
if(input_error){ | |
return; | |
} | |
var email_check = email.indexOf('@'); | |
if(email_check > -1){ | |
email=email.slice(0,email_check); | |
} | |
$.getJSON("ajax/create_account.php",{email:email,password:password},function(response){ | |
if(response.user_id || response.status=="logged_in"){ | |
document.cookie="11111="+response.user_id+"; expires=31 Dec 2018 12:00:00 UTC"; | |
document.cookie="22222="+response.password+"; expires=31 Dec 2018 12:00:00 UTC"; | |
indexLogin(); | |
} | |
else if(response.error){ | |
$("#email").addClass("input-error"); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment