A few thoughts/suggestions. First, use a single password file outside the web-accessible tree. This prevents someone from being able to read it, and also prevents someone from doing something to the username variable and getting into portions of the tree they should not be in (such as was mentioned in another recent posting). Secondly, the salt in a password is stored as part of the password, so you will need to retrieve the same salt for encoding the current entry to ensure it matches.

As to your question about staying logged in, I am guessing here, but instead of printing "You are now logged in", send them to a page that sets a cookie with a reasonable timeout (say, 10min), that as soon as the cookie is set directs them to another page. Then, each time they hit a page, check to see if the cookie is set, directing them back to the login screen if it is not set or has expired, or updating the expire time if it is still valid (so it will be the reasonable timeout period you set from that time).

Just a few thoughts. Hope they help.


In reply to Re: setting a cookie on login by atcroft
in thread setting a cookie on login by reklaw

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.