public function startApp()
 {
     $rootLocation = "Location:http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
     $lv = new LayoutView();
     $ud = new userDAL();
     $sm = new SessionManager();
     $lm = new LoginModel($ud, $sm);
     if (!$lm->isUserLoggedIn()) {
         if ($lv->userWantsToRegister()) {
             $validate = new ValidateCredentials();
             $v = new RegisterView($validate, $sm);
             $c = new RegisterController($v, $ud, $sm);
             $c->userPost();
             if ($sm->SessionGetSuccessfulRegistration()) {
                 header($rootLocation);
             }
         } else {
             $v = new LoginView($lm, $sm);
             $c = new LoginController($v, $lm);
             $c->userPost();
         }
     }
     if ($lm->isUserLoggedIn()) {
         $c = new GameController($lm, $ud, $sm, $lv);
         $v = $c->startApp();
         if ($c->userWantsToLogout()) {
             header($rootLocation);
         }
     }
     $lv->render($v, $lm->isUserLoggedIn());
 }