CGI-Portal
view release on metacpan or search on metacpan
Portal/Sessions.pm view on Meta::CPAN
$sid = md5_hex($$ , time() , rand(8888) );
$cids = $self->{'rdb'}->exec("select $self->{'conf'}{'session_index_field'} from $self->{'conf'}{'session_table'} where $self->{'conf'}{'session_sid_field'} = $sid limit 1")->fetch;
}
# Get current session index
my $cc = $self->{'rdb'}->exec("select $self->{'conf'}{'session_index_field'} from $self->{'conf'}{'session_table'} order by $self->{'conf'}{'session_index_field'} desc limit 1")->fetch;
my $c = $cc->[0]+1;
# Insert session and prepare cookie
$self->{'rdb'}->exec("insert into $self->{'conf'}{'session_table'} ($self->{'conf'}{'session_index_field'},$self->{'conf'}{'session_sid_field'},$self->{'conf'}{'session_user_field'},$self->{'conf'}{'session_start_field'}) values (" . $self->{'rdb'}...
$self->{'cookies'} .= "Set-Cookie: sid=$sid; path=/\n";
}
# Update session start
sub renew_session {
my $self = shift;
my $sid = getcookie('sid');
my $current_time = time();
$self->{'rdb'}->exec("update $self->{'conf'}{'session_table'} set $self->{'conf'}{'session_start_field'}=$current_time where $self->{'conf'}{'session_sid_field'}=" . $self->{'rdb'}->escape($sid));
}
( run in 1.481 second using v1.01-cache-2.11-cpan-e9199f4ba4c )