Re: [Phplib-users] Strange session problem
Brought to you by:
nhruby,
richardarcher
|
From: <new...@dk...> - 2002-03-17 08:31:51
|
Cannot help, but:
Yes, I also have this problem! I've "fixed" it for myself in querying
the session table in the proper database before closing with page_close().
This is a bloody hack but works fine for me at the moment. ;-)
Marco
Carl Youngblood wrote:
>I've been hosting a site with a hosting service that only let me use one
>database. Now I'm trying to get this site running on my home windows
>machine using FoxServ (a combination PHP/MySQL install package for Windows).
>In anticipation of future database fragmentation, I've split my session
>table into a separate database. When this site goes live commercially I
>intend to have multiple database servers and probably one that is dedicated
>to session data. So my session classes look like this:
>
>class SessionDB extends DB_Sql
>{
> var $Host = 'localhost';
> var $Database = 'session';
> var $User = 'myusername';
> var $Password = 'mypassword';
>}
>
>class Bank_CT_Sql extends CT_Sql
>{
> var $database_class = 'SessionDB'; ## Which database to
>connect...
> var $database_table = 'active_sessions'; ## and find our session
>data in this table.
>}
>
>class Bank_Session extends Session
>{
> var $classname = 'Bank_Session';
>
> var $cookiename = ''; ## defaults to
>classname
> var $magic = 'Umuarama'; ## ID seed
> var $mode = 'get'; ## We propagate session
>IDs with cookies
> var $fallback_mode = 'get';
> var $allowcache = 'no';
> var $lifetime = 259200; ## 0 = do session
>cookies, else minutes
> var $that_class = 'Bank_CT_Sql'; ## name of data storage
>container
> var $gc_probability = 25;
> var $gc_time = 720;
> var $auto_init = '../include/setup.inc';
>}
>
>But when I try to log in I get an error message on the login form page that
>displays after the login form itself. It says:
>
>Database error: Invalid SQL: update active_sessions set
>val='QmFua19TZXNzaW9uOiR0aGlzLT5pbiA9ICcnOyAkdGhpcy0+cHQgPSBhcnJheSgpOyAkdGh
>pcy0+cHRbJ2F1dGgnXSA9ICcxJzsgJHRoaXMtPnB0WydjaGFsbGVuZ2UnXSA9ICcxJzsgJEdMT0J
>BTFNbJ2F1dGgnXSA9IG5ldyBCYW5rX0NoYWxsZW5nZV9BdXRoOyAkR0xPQkFMU1snYXV0aCddLT5
>hdXRoID0gYXJyYXkoKTsgJEdMT0JBTFNbJ2F1dGgnXS0+YXV0aFsndWlkJ10gPSAnZm9ybSc7ICR
>HTE9CQUxTWydhdXRoJ10tPmF1dGhbJ3Blcm0nXSA9ICcnOyAkR0xPQkFMU1snYXV0aCddLT5hdXR
>oWydleHAnXSA9ICcyMTQ3NDgzNjQ3JzsgJEdMT0JBTFNbJ2F1dGgnXS0+YXV0aFsncmVmcmVzaCd
>dID0gJzIxNDc0ODM2NDcnOyAkR0xPQkFMU1snY2hhbGxlbmdlJ10gPSAnZDljNTg3YTQ4YzkwMjA
>wMDU5M2Y1MGUxMTYyNTEwNzEnOyA=', changed='20020316202455' where
>sid='7c2d54a5282d1bc17c8ec19d28b662a7' and name='Bank_Session'
>MySQL Error: 1146 (Table 'bank_user.active_sessions' doesn't exist)
>Session halted.
>
>It looks like it is trying to save session info in the wrong database. But
>I put some debugging code into ct_sql.inc at line 97 just before the query
>tries to get executed to see what database name and host the class is
>actually set to. It is set to "session" and not "bank_user" (which is
>another database on the server). Is this a problem in phplib or in php
>itself? It seems really strange that the DB_Sql class would try to connect
>to the wrong database.
>
>Any ideas or help would be greatly appreciated.
>
>Thanks,
>Carl Youngblood
>
>
>_______________________________________________
>Phplib-users mailing list
>Php...@li...
>https://lists.sourceforge.net/lists/listinfo/phplib-users
>
|