Beispiel #1
0
 public function create()
 {
     require 'application/views/general/header.php';
     $userService = new AccountService($this->db);
     if (!empty($_POST['reg_email']) && !empty($_POST['reg_password']) && !empty($_POST['reg_retypepassword'])) {
         if ($_POST['reg_password'] == $_POST['reg_retypepassword']) {
             $user = $userService->create(new Account($_POST['reg_email'], $_POST['reg_password']));
             if ($user != null) {
                 session_regenerate_id(true);
                 $_SESSION['login_user'] = $_POST['reg_email'];
                 header("Location: /");
                 exit;
             }
         }
     }
     header("Location: /user/login");
     exit;
 }