Hi, im using CGI::Application too, but I don't know how to use sessions. I mean, this is the functionality i would like:

1. if a user is unregistered, he just stays at the index page till he presses the register link, which directs him to a register runmode. Then when he registers, i add him to the database, his username,password and email. Then i redirect him to the login page, and show him a login form. When he logs in successfully, and checks a checkbox (make me a cookie or something) i want to create a session for him, where i store his session data in a mysql table.

2. If he arrives at the index page and he's already registered and does have a cookie stored, i want to display a welcome msg to him and so on.

So my question is, where would i put the different stuff? in what subs? would i put it in cgi_prerun? Because i don't want to automatically redirect the unregistered users to a register page when they come to the page, they'll have to click the register button first.

and also, how do i store the session stuff in the mysql table? i mean, does the Driver:mysql take care of it? what if i want more fields? how do i store stuff in them? thank you

In reply to Re: Re: Re: Re: Regarding User Sessions by timmey
in thread Regarding User Sessions by Anonymous Monk

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.