[Israel.pm] CGI::Session

ik idokan at gmail.com
Fri Feb 29 01:25:56 PST 2008


Hello,

The use of a session is to save data like in cookie, where the only
difference is that it is stored on the server side rather then the
client side (that only stores the identifier of the session as a
cookie).

So your authentication should look like so:

if ($session['user'] ne '' and $session['authenticated'] eq 1)
{
  user already authenticated
}
else
{
   do a regular authentication process

   $session['user']              = $user;
   $sesson['authenticated'] = 1;
   ...
}

One very important rule for CGI::Sessions, you must flush the data
before you finish your work or you will have strange errors and
problems.

Ido

On Fri, Feb 29, 2008 at 11:11 AM, Shmuel Fomberg <semuelf at 012.net.il> wrote:
> Hello All.
>
>  I'm trying to write a new web site, and was reading about CGI::Application
>  and CGI::Session.
>  I understand how the CGI::Session use some storage (either file of a
>  simplified database table) to store session information, and a cookie to
>  connect the user to that session. But how do I authenticate the user? Where
>  in the loop I verify user name/password, and say 'I know this user, this is
>  his data', for the Session object to keep?
>
>  Thanks,
>  Shmuel.
>
>
>  _______________________________________________
>  Perl mailing list
>  Perl at perl.org.il
>  http://perl.org.il/mailman/listinfo/perl
>



-- 
http://ik.homelinux.org/



More information about the Perl mailing list