Re: tutorials or examples for HTTP_Session?
| From: | Torsten Roehr | Date: | Fri, 22 Apr 2005 20:40:31 +0000 |
| Subject: | Re: tutorials or examples for HTTP_Session? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18926@lists.php.net to get a copy of this message | ||
"l Burnerheimerton" <lburnerheimerton@yahoo.com> wrote in message
news:20050422145139.56612.qmail@web60613.mail.yahoo.com...
> Trying to find some examples and tutorials for
> HTTP_Session, specifically for storing sessions in
> database. Any links are appreciated!
Hi,
I can't provide a tutorial, just the way I use it:
Install HTTP_Session and DB (an MDB+MDB2 container will be in the next
release) and create a session table (see
HTTP_Session/Container/DB.php for the schema):
ini_set('session.gc_maxlifetime', SESSION_LIFETIME);
ini_set('session.use_trans_sid', 0);
HTTP_Session::useCookies(false);
HTTP_Session::setContainer('DB', array('dsn' => $dsn, 'table' =>
'sessiondata', 'autooptimize' => true));
HTTP_Session::start(SESSION_NAME);
HTTP_Session::setExpire(SESSION_LIFETIME + 3600);
...and off you go.
Although I concurrently use LiveUser for idle/expire handling. At the moment
you cannot pass a DB object to the container. If you use MySQL it will reuse
any open connection so you don't have to fear duplicate DB connections.
Hope this helps!
Best regards, Torsten Roehr