Session Handling php changes - Was RE: [imp] Session HandlingviaMysql

Nigel Cass N.Cass@Hull.ac.uk
Fri, 13 Sep 2002 09:41:31 +0100


Having looked a little deeper into this I now realise that a prepended
file is actually a setting in php.ini which can allow for a php file to
be prepended to every php script that is run. A neat way to include a
set of base functions that you almost always use I guess. Although I
would have thought it would be better to only include the functions when
necessary ?

In my session handler script I define the appropriate functions and then
call session_set_save_handler() so obviously the first time the file is
prepended it will set the session functions to be my user defined ones.

On the face of it this seems like the right way to go for my setup.
However my question for the php experts or even just people who have
setup custom session handling (there must be a number of you ?) is this.


If I set the session handler to be a prepend file - will it cause a
problem if session_set_save_handler() gets called a number of times ?
(i.e first prepend everything is fine - second prepend will it corrupt
the current session or similar when session_set_save_handler() is called
again ?)

Or should I just have the function definitions in my handler script and
always prepend those but have the session_set_save_handler() call in
particular horde/imp/turba php scripts ? - If so could anyone tell me
which scripts I will definitely need those calls in ?

TYIA

Nigel Cass.


> 
> I'm using the RELENG versions of Horde,Imp and Turba.
> 
> I was planning to just use an include statement at the top of the
> relevant php files. I have my session handler php script in
horde/config
> and was hoping to be able to use a line like.
> 
> Include HORDE_BASE . '/config/handler.php'; (note that handler.php
> defines the functions and then calls session_set_save_handler()
> 
> What I am really really unsure of is which php files I have to put
this
> include line into. And where if at all I might have to call
> session_set_save_handler() again.
> 
> Can you advise?
> 
> Apologies for asking questions about RELENG as I realise that things
are
> massively different in HEAD. However the PTB aren't happy with us
using
> HEAD.
> 
> N.
> 
> >
> > Quoting Nigel Cass <N.Cass@Hull.ac.uk>:
> >
> > > I would be most grateful if someone could explain which php
scripts
> I
> > > would definitely need to include the custom session functions
within
> and
> > > at which points I would need to call the
session_set_save_handler()
> > > function. I have looked through the scripts and I "guess" that I
> could
> > > get away with including it at the beginning of horde/login.php and
> > > imp/login.php - but I'm not very knowledgable about php
programming
> and
> > > I have almost certainly missed something obvious.
> >
> > I don't remember what version of IMP you're using, but there is a
> > SessionHandler class in Horde HEAD that you can model your changes
> after.
> > Most people don't actually need code changes, and just use a
> prepend_file.
> >
> > -chuck