Since HTTP is a stateless protocol, the mechanisms for adding "state" (such as "logged in") have to use one or more of the following methods:
- Mangled URLs (including a session key somewhere in the URL)
- Basic Authentication (login box, usually managed in the .htaccess file)
- Hidden fields (if your application goes from one form to another)
- Cookies (but be sure to provide a way to logout easily, or time it out)
- Firing off a separate web server for each session (useful in low-volume
applications)
Each has advantages and disadvantages. Be sure to steer clear of anyone that
advises you to use any of the following:
- IP address, even if attached to browser type (it's not unique for proxies,
and can even change within a single session)
- The Referer (accessed through $ENV{HTTP_REFERER}) which can
be trivially faked and is stripped automatically at some corporate firewalls
- Any kind of client-side session management using Java or Javascript
(some firewalls actually strip this stuff, making your site useless to them,
and all security-conscious people have this stuff turned off anyway)
That should get you started. For more information on some of the session
topics, see
my
WebTechniques Perl column archives.
-- Randal L. Schwartz, Perl hacker
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|