Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

Does anyone know where I might find a snippet of code similar to the one on this site that keeps track of the number of active users online.

I would like to do something similar with CGI

Thanks
edited by boo_radley : changed title (was : Other users)

Replies are listed 'Best First'.
Re: "Other users"- like code in CGI
by Aristotle (Chancellor) on Jan 15, 2003 at 07:59 UTC

    It's just a matter of building a small cache. Insert a timestamp and user ID when the user accesses the site, and expire the entry a few minutes later (15 minutes on PM if I'm not mistaken). Throwing something like Cache::FileCache at the problem makes it easy as pie. The only question, and you haven't mentioned anything about that, is how do you identify your users? PM tracks a cookie set by the script at login.

    Identification is the harder part. Your question whether you can use Win32::NetAdmin suggests you have made no provision for that. You're out of luck there - HTTP has nothing to do with Windows Networking.

    Makeshifts last the longest.

Re: "Other users"- like code in CGI
by fredopalus (Friar) on Jan 15, 2003 at 03:15 UTC
Re: "Other users"- like code in CGI
by Wysardry (Pilgrim) on Jan 15, 2003 at 23:10 UTC

    If you want to keep track of the number of users online without them needing to be logged in somehow, then check the Real Time Counters section of Hotscripts.

    If you only want to show registered, logged in users, then the User Management section would likely be more useful.

Re: "Other users"- like code in CGI
by Anonymous Monk on Jan 15, 2003 at 02:38 UTC
    Thanks boo

    I should have made that title more clear.

Re: "Other users"- like code in CGI
by emilford (Friar) on Jan 15, 2003 at 02:42 UTC
    A search on Google for "perl online users" gave this site.

    I'm not sure if it actually works as I've never used it, but it should at least be a start. Hope it helps.
      I actually have seen that cgi script they offer, and it's NOT what I'm looking for.

      I really want something simple. Do you know if its possible to use the Win32::NetAdmin module?