Re: Save sessions in database ?
| From: | Jens Fischer | Date: | Sat, 22 Jun 2002 20:32:47 +0000 |
| Subject: | Re: Save sessions in database ? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1740@lists.php.net to get a copy of this message | ||
Hallo Guillaume,
Saturday, June 22, 2002, 10:17:45 PM, you wrote:
> Hi all,
> Is it possible in PEAR to save sessions in the database,
> a bit like http://php.weblogs.com/adodb-sessions.
> And how ;-) ?
I use the attached SessionHandler class the following way:
require_once 'SessionHandler.php';
$GLOBALS['sessionhandler'] = new SessionHandler();
@session_set_save_handler('db_sess_open', 'db_sess_close',
'db_sess_read', 'db_sess_write',
'db_sess_destroy', 'db_sess_garbage_collect');
@session_start();
What you might need to adapt is the function "instanceOf($obj,
$classname)" (line 67), which behaves like the new PHP builtin
function is_a().
And you must exchange the DataSource (lines 65 and 66) to reflect your
own instance of DB_common (as usually returned by DB::connect()).
> TIA,
> Guillaume
HTH,
--
MfG,
Jens