Skip to content

Instantly share code, notes, and snippets.

@4815162342
Last active March 13, 2017 02:24
Show Gist options
  • Save 4815162342/2cc90cf30748b2da54a2e4ae4e7d1a18 to your computer and use it in GitHub Desktop.
Save 4815162342/2cc90cf30748b2da54a2e4ae4e7d1a18 to your computer and use it in GitHub Desktop.
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