Re: Re: $_Session vs $_Cookie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Alexey Kupershtokh" <wicked@xxxxxx> wrote in message
news:c9f359$3vo$1@xxxxxxxxxxxxxxxx
> Hi.
>
> > Is your server running on Windows? Have you tried using a database as
your
> > session container?
>
> Hmm... that's something new for me :) How to implement it ? Manually ? Or
it
> is available in php config file?
> Or another question: where I can read about this ? :)

Hi Alexey,

it's pretty simple. I'm using PEAR's HTTP_Session in combination with
PEAR::DB:
http://pear.php.net/package/DB
http://pear.php.net/package/HTTP_Session

Just set those two packages up, create a session table (see
HTTP_Session/Container/DB.php for the schema) and set this HTTP_Session
option:
HTTP_Session::setContainer('DB', array('dsn' => $dsn, 'table' => 'sessions',
'autooptimize' => true));

...and off you go.

Storing session data in a database has some advances over the standard file
based solution, mainly data security und comfort. For example, if you want
to get the number of the active sessions just do a simple select count(*)
from sessions.

Bets regards, Torsten

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux