This is how I did it, just to give you an idea:

1. Verify if username exists in the database. If it exists, fetch the encrypted password.
2. Compere Passowrd with the decrypted password from the database.
3. Generate a session id. It is an encoded result of a username and expiration time.
4. Generate HTML through CGI with the session_id included as part of QUERY_STRING.

Every page that is accessed looks for the session id, decodes it, and if it is valid and not expired, generate the pages desired.

Though I stored IP addresses in a log, I did not include them in the validation since I'm aware of the higher chances that my users would be using their accounts on different machines (with different addresses).

Would this work.....

#Generate the HTML and Dump Cookie (session_id)
&generate_html();

#A function that checks for the Dumped Cookie. If it can't find the cookie it means that the USER_AGENT is closed.
&loop_to_check_for_cookie();

In reply to Re: Re: How should I handle Orphan Sessions? by soon_j
in thread How should I handle Orphan Sessions? by soon_j

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.