isConcurrentSessionExists() public static method

This is done as the following: UserA logs in with his session id('123') and it will be stored in the database. Then, UserB logs in also using the same email and password of UserA from another PC, and also store the session id('456') in the database Now, Whenever UserA performs any action, You then check the session_id() against the last one stored in the database('456'), If they don't match then log both of them out.
See also: Session::updateSessionId()
See also: http://stackoverflow.com/questions/6126285/php-stop-concurrent-user-logins
public static isConcurrentSessionExists ( ) : boolean
return boolean
Example #1
0
 /**
  * Detects if there is concurrent session (i.e. another user logged in with the same current user credentials),
  * If so, then logout.
  */
 public static function checkSessionConcurrency()
 {
     if (Session::userIsLoggedIn()) {
         if (Session::isConcurrentSessionExists()) {
             LoginModel::logout();
             Redirect::home();
             exit;
         }
     }
 }
Example #2
0
 /**
  * Detects if there is concurrent session (i.e. another user logged in with the same current user credentials),
  * If so, then logout.
  */
 public static function checkSessionConcurrency()
 {
     if (Session::userIsLoggedIn()) {
         if (Session::isConcurrentSessionExists()) {
             \Huge\Model\LoginModel::logout();
             Redirect::home();
             Application::stop();
         }
     }
 }
Example #3
0
 private function concurentSession()
 {
     return Session::isConcurrentSessionExists();
 }