RE: [phplib] one sessionmanagement also for more than one database From: Layne Weathers (layne <email protected>)
Date: 10/26/00

> There are some (MySQL) databases, wich I would integrate. The
> administration should be managed with a web-based interface.
> But I have an problem with session and user management based
> on a database. The PHPLIB is easy to use, if you have only
> one database with the required tables "active_sessions, ...".
> If you want to administrate annother database, you have to
> create the same tables in this database. This would be
> redundant and not easy to handle. I would prefer one session
> and user management for the website including data from databases.

The only database which needs session tables is the database you setup in
local.inc in your extension of CT_Sql. Since you want multiple databases,
you extend DB_Sql multiple times. For example:

class DB_Example extends DB_Sql {
        var $Host = 'localhost';
        var $Database = 'database1';
        var $User = 'username1';
        var $Password = 'password1';
}

class DB_Beispiel extends DB_Sql {
        var $Host = 'localhost';
        var $Database = 'database2';
        var $User = 'username2';
        var $Password = 'password2';
}

class Example_CT_Sql extends CT_Sql {
        var $database_class = 'DB_Example';
        var $database_table = 'active_sessions';
}

Now all you do is instantiate each database whenever you need to pull from
it, the session and auth are taken care of for any file that uses this
local.inc.

Layne Weathers
Ifworld, Inc.
layne <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>