nemo has asked for the wisdom of the Perl Monks concerning the following question:
So the session expires but isn't marked as expired. As in the elsif branch for the empty session is executed not the expired branch. Also when I attempt to logout of the session the session id still seems to be valid. A new session id is not generated (I print them out on each page) for the login page. Can anyone point out the flaws in my logic? I've been through the cpan tutorial but I still amn't getting this.sub loadSession($$){ my ($dbhandle,$cgi) = @_; my $session = CGI::Session->load("driver:MySQL", $cgi, {Handle=>$d +bhandle}); if ( $session->is_expired && $session->param("logged_in")) { displayLoginPage("Your session has expired, please log in agai +n"); exit(0); }elsif ( $session->is_empty) { $session = $session->new("driver:MySQL", $cgi, {Handle=>$dbhan +dle}); $session->expire('+1m'); print $session->header(); displayLoginPage(undef); exit(0); }else{ print $session->header(); } return $session; } sub logout($$){ my($cgi,$dbhandler) = @_; my $session = CGI::Session->load("driver:MySQL", $cgi, {Handle=>$d +bhandler}) or die CGI::Session->errstr; $session->clear(); $session->delete(); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problems with CGI Sessions
by moritz (Cardinal) on Dec 02, 2007 at 14:45 UTC | |
Re: Problems with CGI Sessions
by fenLisesi (Priest) on Dec 02, 2007 at 14:54 UTC |