Forum Moderators: DixonJones

Message Too Old, No Replies

Counting users online

Opinions on best method?

         

Birdman

7:36 am on Jan 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello. I wan't to add the "xx Users Currently Online" feature to a website and was wondering which method is best:
  • Database
  • Cookies
  • Sessions

I use php with this site. Thanks for any input!

<added>Whoa, just saw the other thread with same subject. Sorry!

BjarneDM

10:07 pm on Jan 2, 2003 (gmt 0)

10+ Year Member



something that I'm experimenting with is log-analysis:
[unix-prompt]tail -n 50 access_log ¦ sed 's/\[.*//' ¦ sort ¦ uniq ¦ uniq -f 20 -c
from inside php on the standard common format of Apache access-logging

it breaks down as follows:
-- display the last 50 lines of the access_log
tail -n 50 access_log
-- remove everyting from the start of the date so you've ony got the ip-numbers
sed 's/\[.*//'
-- sort the ip-numbers
sort
-- remove duplicates
uniq
-- count the number of unique ip-numbers
uniq -f 20 -c