function addUserToDB(){

  checkUserNames(userNameField.value);

  if (nameField.value === "" || userNameField.value === "" || pinField.value === "" || pinconfField.value === ""){
    alert("It looks like you left some fields blank. Make sure you have your full name, username, a pin, and " +
      "a confirmed pin below.");
  } else if (pinconfField.value !== pinField.value){
    alert("It looks like the pins you entered are not the same");
  } else if (!isNaN(pinField.value) == false) {
    alert("It looks like the pins you entered are not numeric, please make sure that they are numbers only");
  } else if (userNameBool == false){
    alert("It looks like the User Name you chose is already taken, please choose another.");
    userNameBool = true;
  } else {
    var newUid = firebase.database().ref("users").push();
    var newPin = parseInt(pinField.value);
    injectUserArr(userArr);
    var encodeKey = encode(pinField.value);
    var shareCodeNew = genShareCode();
    console.log(shareCodeNew);
    newUid = newUid.toString();
    newUid = newUid.substr(45, 64);
    firebase.database().ref("users/" + newUid).set({
      name: nameField.value,
      pin: newPin,
      encodeStr: encodeKey,
      userName: userNameField.value,
      ban: 0,
      firstLogin: 0,
      moderatorInt: 0,
      organize: 0,
      strike: 0,
      theme: 0,
      uid: newUid,
      warn: 0,
      shareCode: shareCodeNew
    });

    btnUpdate.innerHTML = "Please Wait...";
    btnUpdate.onclick = function(){};//forces the update button to do nothing
    btnDelete.onclick = function(){};//forces the delete button to do nothing
    window.location.href = "index.html";
  }
}
//function, with the small difference of needing to add a new user to the database and redirect to the login page.
function, with the small difference of needing to add a new user to the database and redirect to the login page.
function with the small difference of needing to add a new user to the database and redirect to the login page .
function addUserToDB(){
  checkUserNames(userNameField.value);
  if (nameField.value === "" || userNameField.value === "" || pinField.value === "" || pinconfField.value === ""){
    alert("It looks like you left some fields blank. Make sure you have your full name, username, a pin, and " +
      "a confirmed pin below.");
  } else if (pinconfField.value !== pinField.value){
    alert("It looks like the pins you entered are not the same");
  } else if (!isNaN(pinField.value) == false) {
    alert("It looks like the pins you entered are not numeric, please make sure that they are numbers only");
  } else if (userNameBool == false){
    alert("It looks like the User Name you chose is already taken, please choose another.");
    userNameBool = true;
  } else {
    var newUid = firebase.database().ref("users").push();
    var newPin = parseInt(pinField.value);
    injectUserArr(userArr);
    var encodeKey = encode(pinField.value);
    var shareCodeNew = genShareCode();
    console.log(shareCodeNew);
    newUid = newUid.toString();
    newUid = newUid.substr(45, 64);
    firebase.database().ref("users/" + newUid).set({
      name: nameField.value,
      pin: newPin,
      encodeStr: encodeKey,
      userName: userNameField.value,
      ban: 0,
      firstLogin: 0,
      moderatorInt: 0,
      organize: 0,
      strike: 0,
      theme: 0,
      uid: newUid,
      warn: 0,
      shareCode: shareCodeNew
    });
    btnUpdate.innerHTML = "Please Wait...";
    btnUpdate.onclick = function(){};
    btnDelete.onclick = function(){};
    window.location.href = "index.html";
  }
}
function addUserToDB ( ) { checkUserNames ( userNameField . value ) ; if ( nameField . value === "" || userNameField . value === "" || pinField . value === "" || pinconfField . value === "" ) { alert ( "It looks like you left some fields blank. Make sure you have your full name, username, a pin, and " + "a confirmed pin below." ) ; } else if ( pinconfField . value !== pinField . value ) { alert ( "It looks like the pins you entered are not the same" ) ; } else if ( ! isNaN ( pinField . value ) == false ) { alert ( "It looks like the pins you entered are not numeric, please make sure that they are numbers only" ) ; } else if ( userNameBool == false ) { alert ( "It looks like the User Name you chose is already taken, please choose another." ) ; userNameBool = true ; } else { var newUid = firebase . database ( ) . ref ( "users" ) . push ( ) ; var newPin = parseInt ( pinField . value ) ; injectUserArr ( userArr ) ; var encodeKey = encode ( pinField . value ) ; var shareCodeNew = genShareCode ( ) ; console . log ( shareCodeNew ) ; newUid = newUid . toString ( ) ; newUid = newUid . substr ( 45 , 64 ) ; firebase . database ( ) . ref ( "users/" + newUid ) . set ( { name : nameField . value , pin : newPin , encodeStr : encodeKey , userName : userNameField . value , ban : 0 , firstLogin : 0 , moderatorInt : 0 , organize : 0 , strike : 0 , theme : 0 , uid : newUid , warn : 0 , shareCode : shareCodeNew } ) ; btnUpdate . innerHTML = "Please Wait..." ; btnUpdate . onclick = function ( ) { } ; btnDelete . onclick = function ( ) { } ; window . location . href = "index.html" ; } }
function, with the small difference of needing to add a new user to the database and redirect to the login page.
function with the small difference of needing to add a new user to the database and redirect to the login page .
//forces the update button to do nothing //forces the delete button to do nothing