On 15 Sep 2008, at 16:59, Thodoris wrote:
On Mon, Sep 15, 2008 at 11:35 AM, Thodoris <tgol@xxxxxxxxxx> wrote:
On Mon, Sep 15, 2008 at 11:20 AM, Thodoris <tgol@xxxxxxxxxx> wrote:
Also just to throw this out, you can also use the
session_set_save_handler
function. This will let you store your sessions wherever you
see fit.
file
system, database, etc. Comes in handy when you're on multiple
web
servers.
http://us2.php.net/session_set_save_handler
Living to learn every single day. Although I find this feature
very
useful
(storing session data in a database for e.g. mysql) I didn't
find any
good
example in the manual or anywhere near using it.
Can anyone enlighten me on this ?
--
Thodoris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Yeah, I found this method great when I had to get sessions away
from the
file system. It let's you keep using $_SESSION while not losing
sessions
everytime the load balancer redirects someone.
Check out Stut's link, its perfect.
Thanks guys but do you think I could find this in a non object-
oriented
manner ? I have already seen this link in a previous posting and
it is
really very good.
--
Thodoris
Well, instead of a class, just make functions. Make them
according to what
you set in the session handler.
session_set_save_handler("open", "close", "read", "write",
"destroy", "gc");
Example: "open" maps to "function open() { ... }".
Make sense?
Thanks I have already started working on that. I suppose that I
should run the garbage collector every now and then to see if the
session has expired. I guess this is the basic difference between
the normal sessions and database oriented. The fact that you need
to create a way to check the sessions that are expiring.
Not at all. The garbage collector is run by the session extension
according to rules set out in php.ini. It does it for you. Doesn't
matter whether it's OO or not.
-Stut
--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php