Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function validateSignup() {
- var username = document.forms["signup_form"]["username"].value;
- var pass = document.forms["signup_form"]["password"].value;
- var confirm_pass = document.forms["signup_form"]["confirm_password"].value;
- var email = document.forms["signup_form"]["email"].value;
- if(username == "" || pass == "" || confirm_pass == "" || email == "") {
- $("#signup_error").attr("class", "alert alert-danger");
- $("#signup_error").html("All details required. Please fill in all fields.");
- return false;
- } else if(pass != confirm_pass) {
- $("#signup_error").attr("class", "alert alert-danger");
- $("#signup_error").html("Passwords doesn't match.");
- return false;
- }
- else {
- $.ajax({
- url: "authentication.php",
- type: "POST",
- data: { "username" : username, "password" : pass, "email" : email, "subscription" : subscription, "method" : "register"},
- success: function(data){
- console.log(data);
- if(data == true) {
- var count = 3;
- $("#signup_error").attr("class", "alert alert-success");
- $("#signup_error").html("<i class='fa fa-check'></i> Registration successful! Please confirm your e-mail address in order to make your account active. Redirecting in <div id='timer' style='display: inline'></div>");
- document.getElementById('timer').innerHTML = count;
- setInterval(function(){
- count--;
- document.getElementById('timer').innerHTML = count;
- if (count == 0) {
- window.location = 'http://ghostbg.interdevice.club/';
- }
- },1000);
- return false;
- } else {
- $("#signup_error").attr("class", "alert alert-danger");
- $("#signup_error").html("<i class='fa fa-ban'></i> Account with that username/email already exist.");
- return false;
- }
- }
- });
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement