shamsuljewel Posted September 12, 2007 Share Posted September 12, 2007 I want the statistics that how many users are in my domain. that is I have many pages on my site...I want to count them all. I found some php coding that uses file .txt..works fine but working only for a specific page not for the whole site. any suggestion will preferred.. Quote Link to comment https://forums.phpfreaks.com/topic/69006-how-to-know-how-many-users-are-currently-online-at-my-site/ Share on other sites More sharing options...
ToonMariner Posted September 12, 2007 Share Posted September 12, 2007 when they login you need to update a table (or flatfile or some setting of your choice) to add 1 to the number of people online - you will also need to store the time and some method of maintaining state (like a cookie or session var). each page request you will need to update the time the user has been active. if they logout or the activity has been dormant for say 10 mins then remove them from the logged in brigaed and subtract one from the online count (if you use a database table you need only count number of rows of course) Quote Link to comment https://forums.phpfreaks.com/topic/69006-how-to-know-how-many-users-are-currently-online-at-my-site/#findComment-346844 Share on other sites More sharing options...
shamsuljewel Posted September 12, 2007 Author Share Posted September 12, 2007 thanks for the idea... but by using session I can only know the registered users..isn't it? I need to know all the users registered login and guests also... Quote Link to comment https://forums.phpfreaks.com/topic/69006-how-to-know-how-many-users-are-currently-online-at-my-site/#findComment-346856 Share on other sites More sharing options...
xyn Posted September 12, 2007 Share Posted September 12, 2007 create a timestamp fro your logged in members, update every page they view. and then run aquery "X users online in last X minutes". (recommended 5) then do the same for guests but this time by SESSION. Quote Link to comment https://forums.phpfreaks.com/topic/69006-how-to-know-how-many-users-are-currently-online-at-my-site/#findComment-346857 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.