I\'m a beginner to PHP and I\'m writing some code to my site. I want to get the total number of sessions that is active at that instant. I knew this is some difficult task b
If you add/have a mysql table for statistics analysis which has at least ip address and time columns, even if your site has no membership activity, table will be populated by clicks of visitors.
In each of your page, insert ip and time to this table.
Then you can fetch distinct ip addresses clicked at most 15 minutes ago. Duration is strictly related your content, it may be even 10 secs or 1 hour. Ask yourself if you were your visitor, how much will you surf on your site and be honest of course:)
Lastly, your table will be fat after a time. Decide the frequency and logic and methodology to delete the useless rows. Clean the table on each arrival of your frequency which depends on your site traffic and sources.