Forum Moderators: coopster & phranque

Message Too Old, No Replies

Getting a session to expire in PERL

         

TOTFCuser

4:50 am on Jun 9, 2003 (gmt 0)

10+ Year Member



Hi all,

This is actually a Perl_DBI/MySQL question. I am using session IDs with the CGI:Session module. I am not using cookies to pass info for various reasons. My Problem is this. I can delete sessions, set flags and do other successful tests.

When I try to expire a given session, it does not expire at all. The snippet of code below is a short, short version of the script. I am going crazy! Does anyone see a mistake I am just not seeing. I am also displaying other modules that are not needed for the code below but I listed them just incase someone can see a collision that is not easily spotted through regular error checking.

#!/usr/bin/perl -w

use DBI;
use CGI;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
use CGI::Session qw/-api3/;
use CGI::Session qw/-ip-match/;

$CGI::POST_MAX=1024 * 100; # max 100K posts
$CGI::DISABLE_UPLOADS = 1; # no uploads

$dbh = DBI->connect("DBI:mysql:$database:$hostname", $usernames, $passwords, {RaiseError => 1, PrintError => 1}) or die("Can't connect to db: ",$dbh->errstr);

CGI::Session->name("BLA_bla");

$getNewSession = new CGI;
my $sid = $getNewSession->param('BLA_bla') ¦¦ undef;

my $session = new CGI::Session('driver:MySQL', $sid, {Handle=>$dbh});

$session->param("_login-trials",1);

$session->expire('+25m');
$sessid = $session->id();

$dbh->disconnect;

[edited by: jatar_k at 7:58 pm (utc) on June 9, 2003]

jatar_k

7:58 pm on Jun 9, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



shameless bump after split to own topic