Hey everyone.

I'm attempting to write a system that manages user sessions for a website where users can post their school notes.

Currently, I'm trying to display the number of viewers "lurking" (aka "Guests"), and display the username for each user that is logged in (their name dissappears from the list after they log out or their session expires, not exactly a new idea.).

I'm having a heck of a time trying to figure this section out. I'm using CGI::Session, and am probably going to migrate to Apache::Session. However, this doesn't solve the problem of figuring out how to

A) Insert user's information that are logged on into a database table,

B) expire their session/set their logged_in parameter to '0',

C) Pull the above two together so that I have something similar to what perlmonks has ("Other users lurking in the monastery"), along with a count of guests with active sessions ("Guests online: $Number").

Part A's fairly easy, but I need to design part A so it's compatible with part B and C.

My main goal is to avoid redundancy. I want to expire the session stuff once, not have to expire a session file/database record, and the stuff in the table for users online.

I'm tired, and I've tried all of what I know to exhaustion. Any ideas, wise monks?

meh.

In reply to Session management: counting number of users currently viewing website and displaying users online by stonecolddevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.