Mahdi Posted November 14, 2006 Share Posted November 14, 2006 Hello,I wanted to know if it is possible to monitor $_SESSION data that is currently active on the server.I.E.We set $_SESSION['userID'] when someone logs into their account, we would like to actively monitor the time that this session remains active. So if the user is online for 6 hours, we use a PHP page that pulls this information.start time = 8:00AMuser1 logs on at 8:15AMuser2 logs on at 8:45AMuser3 logs on at 9:30AMcurrent time = 10:00AMuser1 is offline, session was active for 45 minutes (logged off at 9:00AM)user2 is active, and has been on for 1h 15minsuser3 is active, and has been on for 30mins______________Kind of a rough idea I know, but I wanted to know if getting this kind of information is even possible with sessions, or cookies for that matter.Thanks a ton!Mahdi Link to comment https://forums.phpfreaks.com/topic/27169-php-session-monitoring/ Share on other sites More sharing options...
btherl Posted November 14, 2006 Share Posted November 14, 2006 Usually, session data is stored in files. It may be stored in /tmp , or in some other directory. There's more information at http://sg.php.net/manual/en/ref.session.phpBut I would recommend keeping your own records in a database if possible. A text file would also be good enough. Keep in mind that if someone just closes the browser without logging out, their session will stay forever unless you have a system in place for clearing out old sessions. Link to comment https://forums.phpfreaks.com/topic/27169-php-session-monitoring/#findComment-124295 Share on other sites More sharing options...
Mahdi Posted November 14, 2006 Author Share Posted November 14, 2006 Thanks for the reply.I was of course going to pair this information with a database, but the problem for me was knowing how long a user has been logged in, and when they sign off.Similar to the "Total time logged in:" function of these php forums. Link to comment https://forums.phpfreaks.com/topic/27169-php-session-monitoring/#findComment-124640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.