I want to make my website available to all visitors, but restrict its use via logins. By default there would be a login link available at the top of each page.

The user clicks this link in order to login (the first time), and if successful will be known for the rest of the session via a given username and a "~logged-in" variable. This sessions will timeout after 30 minutes idle time.

If the user wishes he can enable automatic login through the use of cookies which is the usual checkbox he can check during the login form.

In addition to being able to access the whole site, the logged-in users will also be able to enter user-specific pages for entering data, e.g. hours of a timesheet.

Other visitors can view these same timesheets, but if not logged in as the owner can only have read-only access, e.g. I can disable or hide certain buttons and make all input text fields readonly.

The logged-in person can logout at anytime, after which he must login again to make changes.

Also, I should have admin access to edit the usernames, passwords, emails etc. And of course, the individual users should be able to change their own settings here.

Is there an example cgi script which accomplishes this, e.g. using CGI::Session or whatever?

Thanks in advance for the time and attention.


In reply to Persistent login session with restricted access by kgish

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.