Re: Re: $_Session vs $_Cookie

From: Date: Mon, 31 May 2004 11:31:03 +0000
Subject: Re: Re: $_Session vs $_Cookie
References: 1 2 3 4 5 6 7  Groups: php.db 
Request: Send a blank email to php-db+get-34600@lists.php.net to get a copy of this message
"Alexey Kupershtokh" <wicked@ngs.ru> wrote in message news:c9f359$3vo$1@sea.gmane.org... > 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

« previous php.db (#34600) next »