示例#1
0
 public function bRegisterUser($reg_email, $reg_fname, $reg_aname)
 {
     # get the connection
     $mysqli = Parent::connect();
     # get password generator
     $oPassword = Singleton::getInstance('Password');
     # get a random password
     $random_password = $oPassword->encryptPassword();
     # check if succeed otherwise try again
     if (!$random_password) {
         $random_password = $oPassword->randomPassword();
     }
     #lowercase email
     $slEmail = strtolower($reg_email);
     if ($sStmt = $mysqli->prepare("INSERT INTO `users`(`username`, `password`, `voornaam`, `achternaam`, `email`) VALUES (?,?,?,?,?)")) {
         # bind
         $sStmt->bind_param('sssss', $reg_fname, $random_password, $reg_fname, $reg_aname, $reg_email);
         # execute
         if ($sStmt->execute()) {
             User::sendRegistrationMail($reg_email, $random_password);
         } else {
             echo "een paar fouten";
         }
     }
 }