public function postRegister() { session_start(); $userRepo = new UserRepository(); if ($_POST['password'] == $_POST['passwordConfirmation']) { $user = new User(); $user->email = $_POST['email']; $user->username = $_POST['username']; if ($_POST['password'] != "") { $user->password = password_hash($_POST['password'], PASSWORD_BCRYPT); } $user->fullname = $_POST['fullname']; $userRepo->insert($user); } $this->postLogin(); header('Location: /'); }