Welcome to WebmasterWorld Guest from 188.8.131.52
Forum Moderators: phranque
the question is, without turning to a 3rd party stats service, how can I determine this, even if its just for myself and not for public posting (which I think can be tacky in some cases, like public page counters)
is this a complex piece of code? can it be done in perl/SSI? php?
any small open source around that someone can point me to before I waste alot of hours on this ;)
joined:June 28, 2002
1. keep a seperate log, a simple text file, written to by the most popular pages on the site via SSI, with a simple timestamp and IP
2. every time the script is triggered (by SSI, etc) first trim the log - remove any entries that are over 5 minutes old
3. every time the script is triggered, after trimmed, count the number of unique ip's found
that final number, more or less, is your number of unique visitors in the past five minutes, hence your "number of people online"
the biggest weakness is of course people on aol proxies and other huge proxies but that number shouldn't too far off
It sounds like you already know what to do, if you want to see examples of how others have done it...or, you just don't want to re-invent the wheel, you can find scripts that do what you're asking at hotscripts.com. I cannot recommend any particular one, as I haven't used one.
This a good resource for free or open source code for many things, in the language of your choice. I often find it helpful to study someone else's code, when I'm stumped.
I 'highly' recommend that you actually understand every line of code in any of these scripts before deploying it on your site!