Jump to content

Application object


joinnew
 Share

Recommended Posts

If you want to show the number of users currently online, what we have been telling people to do is keep track of IP address/timestamp combinations in a database. To do that, you need a piece of code on every page that checks the user's IP address, and checks if the IP is already in the database. If it is not, then you add the IP address with the current timestamp. If it is already there, then you update the timestamp to the current time. Then, to see how many people are using the site, you can get the number of users with a timestamp greater then, for example, 5 minutes ago.There is a PHP function called session_set_save_handler, I think that an easier way would be to use that function to define your own session handling functions that would store sessions in the database. Then you wouldn't have to explicitly update the IP/timestamp info on each page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...