How to check whether the user is authorized by session?

Auth::check() and Session::all() - return data for the current session. Session::all() also returns a login_web_ ... field login_web_ ... which tells us that the user is authorized. How to get to it from the current session, knowing the id of another session?

  • What does another session mean? Only one session file is created for each user. - sepgg
  • Other means not current for one user. Yes, one file per user. How can I find out about the status of another from one authorized user? - Zippbl4

1 answer 1

UPD.

Altered through Session::getHandler() with the read($sessionId) method http://php.net/manual/ru/class.sessionhandlerinterface.php

 public static function CheckBySessionId($sessionId = '') { $session = Session::getHandler()->read($sessionId); if (!$session) { return false; } foreach(unserialize($session) as $key => $val) { if (preg_match("/^login_web_[0-9a-z]+$/", $key)) { return true; } } return false; }