If you're looking for something like
a count of total memebers signed in or
a list of all memebers signed in then you could do what we did.
That is just have each page request store which user the page was requested for and the current time in a database table. Make the UserID field unique and it shouldn't grow out of hand. When looking to get stats you can just
SELECT COUNT(*) FROM ActiveSessions or
SELECT UserID FROM ActiveSessions. I would suggest clearing old records from the table with a 5 minute cron or a pseudo-random system (maybe 1 in 500 page loads).
Another thing you can do is actually have summary data that is generated either a) every say 5 minutes or b) whenever that data is changed (ie someone logged in or out). This plan works better on things that don't change very often or where you have a high number of records to deal with.
Note that this method can get database intensive when you get a lot of site traffic. For the above linked site the sessions database does not run on the same machines that run the site's actual content database.
PS: Yes I wrote machines as in plural. 60 Gigs of of web files (ie not including protocol overhead) is not an odd weekday. I think those databases get a fair bit of work for a website. -
frink
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.