Apache::Session

perl

create database sessions;
use sessions;
create table sessions(id varchar(32), length int(11), a_session blob);

use Apache::Session::MySQL;
my %session;
tie %session,'Apache::Session::MySQL';    // make a new session
$session{'Visa_number'} = 'blah blah';
$id = $session{_session_id};             // get the session ID for later use

tie %session, 'Apache::Session::MySQL', $id    // get stuff back out
tied(%session)->delete;                    // delete a session permanently

my %session;
tie %session, 'Apache::Session::MySQL', $id, {
    DataSource => 'DBI:mysql:sessions',
    UserName => 'ads',
    Password => 'some_password',
    LockDataSource => 'DBI:mysql:sessions',
    LockUserName => 'ads',
    LockPassword => 'some_password'
};
untie(%session);
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License