Beispiel #1
0
 /**
  * combines all other methods under one hood. returns true on success and if the username is taken message on failure.
  */
 public function register($username, $password, $phonenumber, $type = null)
 {
     $code = md5(mt_rand());
     $username = parent::sanitize($username);
     $password = parent::sanitize($password);
     $phonenumber = parent::sanitize($phonenumber);
     $result = $this->inputNewUser($username, $password, $phonenumber, $code, $type);
     // inputs a new user if username is not taken
     if ($result) {
         //$this->inputEmail($username); // this method becomes useful if everyone uses a school email, because then the method can just concatenate the school's domain to the end of the username.
         $this->activateNewUser($username, $code);
         return true;
         // success in inputting user
     } else {
         return false;
         // username already taken
     }
 }
Beispiel #2
0
 /**
  * combines all other methods under one hood. returns true on success and the username is taken message on failure.
  */
 public function register($username, $password, $phonenumber)
 {
     $code = md5(mt_rand());
     $username = parent::sanitize($username);
     $password = parent::sanitize($password);
     $phonenumber = parent::sanitize($phonenumber);
     $result = $this->inputNewUser($username, $password, $phonenumber, $code);
     // result stores false or text string 'true' depending on the outcome of the input method
     if ($result) {
         //print 'result is TRUE';
         $this->inputEmail($username);
         $this->emailNewUser($username, $code);
         return true;
         // success in inputting user
     } else {
         return false;
         // username already taken
     }
 }