Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Checking user sessions, how?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Checking user sessions, how?

Postby Laiwa » Mon Jun 02, 2003 1:44 pm

How do I check the users that are on my pages, when they enter and when they leave? Are there some session variables that signifies unique users on the site / or when they go offline?
I have tried to search the net on this topic but without luck.
Hope someone can help.
New php-forum User
New php-forum User
Posts: 7
Joined: Sat May 31, 2003 9:10 am
Location: Barcelona, Spain

Postby Redcircle » Mon Jun 02, 2003 6:50 pm

the best ways to track users would be to keep a database with the session ID and time in a table.

everytime the user does something on the webpage it updates the current time associated with that session_id.

also everytime the script is run you can have it delete all those that are older than 5 mins. This will give an approximation on who has been active within the last five minutes

PHP is a serverside language. To my knowledge there is no way to see which sessions are still active because there is no constant connection with the clients computer. You can do it in java with a server/client model but most servers do not allow you to run your own daemon. So the only way you can find out who is active or not is to set a timeout.
User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.