Ask about general coding issues or problems here.
Moderators: macek, egami, gesf
- New php-forum User
- Posts: 7
- Joined: Sat May 31, 2003 9:10 am
- Location: Barcelona, Spain
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.
- Posts: 830
- Joined: Tue Jan 21, 2003 10:42 pm
- Location: Michigan USA
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.
Return to “PHP coding => General”
Who is online
Users browsing this forum: No registered users and 3 guests