Gossamer Forum
Home : General : Perl Programming :

session

Quote Reply
session
i was doing some tests with sessions...
Quote:
CGI::Session->name($scookie);
$session = new CGI::Session("driver:File",$scookie,{'Directory'=>"/home/mysite/cgi-bin/sessions/"}) or die "$!";
if ($session->param('_IDLE_EXPIRY') < time + 120) {
$session->expire('+1m');
print "Content-Type: text/html\n\n";
print('Warn: you were away more then 2 minutes<br>we will take you to the main page.<META HTTP-EQUIV=REFRESH CONTENT="5;URL=/?>');
exit;
} else {
# add 2 minutes to the timer
$session->param('_IDLE_EXPIRY' => time + 120);
}
print "Content-Type: text/html\n\n";
print 'Time: '.$session->param('_IDLE_EXPIRY')."\n";

well its just not working as it should...
The "if" check if the timer is less then "now+2minutes" if it is your session goes to 1 minute expire and youre take to the main page to re-log if not your session is setup with 2+ minutes.
when i login in i am taken to the right message but if i refresh the page i am taken as expired.
i am using the follow code to generate the session:
Quote:
$session = new CGI::Session("driver:File",undef,{'Directory'=>"/home/mysite/cgi-bin/sessions/"});
$session->param('user',"$id");
$session->param('_IDLE_EXPIRY' => time + 120);
$session->expire('+1d');
Subject Author Views Date
Thread session NamedRisk 5210 Mar 19, 2006, 9:39 PM
Thread Re: [NamedRisk] session
mkp 5105 Mar 22, 2006, 2:04 AM
Thread Re: [mkp] session
NamedRisk 5102 Mar 24, 2006, 3:38 AM
Thread Re: [NamedRisk] session
mkp 5088 Mar 28, 2006, 12:28 AM
Post Re: [mkp] session
NamedRisk 5087 Mar 28, 2006, 6:04 AM