isUserLoggedIn() публичный статический Метод

Returns the current state of the user's login
public static isUserLoggedIn ( ) : boolean
Результат boolean user's login status
Пример #1
0
 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());
 }
 public function register()
 {
     if (LoginModel::isUserLoggedIn()) {
         Redirect::home();
     } else {
         $this->view->render('login/register');
     }
 }
Пример #3
0
 /**
  * Register page
  * Show the register form, but redirect to main-page if user is already logged-in
  */
 public function index()
 {
     if (LoginModel::isUserLoggedIn()) {
         Redirect::home();
     } else {
         $this->View->renderPlain('register/index');
     }
 }
Пример #4
0
 /**
  * Index, default action (shows the login form), when you do login/index
  */
 public function index()
 {
     // if user is logged in redirect to main-page, if not show the view
     if (LoginModel::isUserLoggedIn()) {
         Redirect::home();
     } else {
         $data = array('redirect' => Request::get('redirect') ? Request::get('redirect') : NULL);
         $this->View->render('login/index', $data);
     }
 }
 public function startApp()
 {
     $dtv = new DateTimeView();
     $lv = new LayoutView();
     $ud = new userDAL();
     $lm = new LoginModel($ud);
     if (isset($_GET['register'])) {
         $validate = new ValidateCredentials();
         $v = new RegisterView($validate);
         $rc = new RegisterController($v, $ud);
         $rc->userPost();
         if (isset($_SESSION['successfulRegistration']) && $_SESSION['successfulRegistration'] == true) {
             header("Location:http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
         }
     } else {
         $v = new LoginView($lm);
         $lc = new LoginController($v, $lm);
         $lc->userPost();
     }
     $lv->render($lm->isUserLoggedIn(), $v, $dtv);
 }
                            <li role="separator" class="divider"></li>
                            <li><a href="<?php 
    echo Config::get('URL');
    ?>
conference/create">Create new conference</a></li>
                        </ul>
                    </li>
                </ul>
                <?php 
}
?>

                <!-- show logged in user info here -->
                <ul class="nav navbar-nav navbar-right">
                    <?php 
if (LoginModel::isUserLoggedIn()) {
    ?>
                        <p class="navbar-text">Signed in as <?php 
    echo Session::get("user_name");
    ?>
                    <?php 
    if (Session::get("user_account_type") == 7) {
        ?>
- administrator
                    <?php 
    }
    ?>
</p><?php 
}
?>
                </ul>
Пример #7
0
<?php

//INCLUDE THE FILES NEEDED...
//VIEW...
require_once 'view/LoginView.php';
require_once 'view/DateTimeView.php';
require_once 'view/LayoutView.php';
//CONTROLLER...
require_once 'controller/LoginController.php';
require_once 'controller/updateSession.php';
//MODEL...
require_once 'model/LoginModel.php';
//MAKE SURE ERRORS ARE SHOWN... MIGHT WANT TO TURN THIS OFF ON A PUBLIC SERVER
error_reporting(E_ALL);
ini_set('display_errors', 'On');
//CREATE OBJECTS OF THE MODEL
$loginModel = new LoginModel();
//CREATE OBJECTS OF THE VIEWS
$v = new LoginView($loginModel);
$dtv = new DateTimeView();
$lv = new LayoutView();
//CREATE OBJECTS OF THE CONTROLLER
$updateSession = new UpdateSession();
$loginController = new LoginController($v, $loginModel, $updateSession);
$loginController->Start();
$lv->render($loginModel->isUserLoggedIn(), $v, $dtv);