Suppose several users are authorized on the site in this way:

session_start(); $SESSION['login'] = $login; 

Is it possible in some way to find out which logins are now authorized by the launch of the squeaking crown? As far as I know, each session is unique and has its own ID, is it possible to somehow know which sessions are alive and which login belong to?

    2 answers 2

    With the help of session_save_path get a folder where php stores the session. Next, read the files from the folder and decode with session_decode. Look at the presence of the login variable in the session. Etc.

      yes just write to the database session data, for that matter

       mysql_query("UPDATE user SET time='".time()."' WHERE session_id='".$session_id."'",$db); // обновляем время (для проверки кто онлайн) 

      And always just let it be updated, well, check for example online only if time in the database is no more than 5 minutes from the current time.