[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Count
>
> Hi, I know it's a difficult task but I REALLY need a function that will:
>
> A) Show total # of users currently online
> B) Show "which" users are currently online
>
> I'm using IC 4.8 and a SQL database.
>
> ANY help at all would be really appreciated.
>
It's not a difficult task, just expensive in terms of the processing
required to work it out. This has been covered before, so a scan
of the list archives may turn up some useful code. Basically, you
need to do the following:
1. Decide how long a user may remain inactive before being
considered "offline" for the purposes of your report.
(Five minutes is probably ok for this).
2. Scan through the session files/table/etc., looking for
users that are "online", using the criteria in (1).
3. For each session found, extract the logged-in username
(if any).
4. Produce some text that says "5 users online", followed by
a list of usernames, followed by "2 anonymous users" (or
whatever you want to display).
It's not difficult from a programming point of view, but I doubt that
you'd want to show that report on every page. If your site is busy
then a [timed-build] may come in useful here, as long as you set the
timeout to a very low number; probably around half of the time you
decide for (1).
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
- References:
- [ic] Count
- From: interchange-users@icdevgroup.org (Singles 2 Couples)