Hello!
I do a general authorization for yii2 and samopisny engine. I managed the authorization through cookies, but there was a problem in the sessions. I do not know how to get user data from the yii session.
Follow-up scheme:
- All authorization takes place on a subdomain (sub.doamin.local) with yii2
- yii transmits a session cookie to all host subdomains. Kuku called YIISID
- on domain.local domain there is a self-written framework in which you need to somehow read the data from the YIISID and also start the session.
- Files of sessions yii and samopisa lie in one place.

With the transfer of cookies there were no problems, as I need them, they are visible on all subdomains.
The only problem is how to read the data from YIISID.
I know that you can take the session id from YIISID and then find the session file on disk using it and read the necessary data from the file, but it seems to me there is a more civilized way.

ps Perhaps the solution is a trifling, but do not kick hard, I am not familiar with the sessions.

    2 answers 2

    Try this

    if(isset($_COOKIE['YIISID'])){ session_id($_COOKIE['YIISID']); } session_start(); echo $_SESSION['foo']; 

      to use the session you need to start session_start()

      then write to the session the necessary data $_SESSION['foo'] = 'value';

      and then they can be honored in any $_SESSION['foo'] script