Yet another question about session management in PHP4. I'd greatly appreciate it if you could help me out.
The problem is as follows: I've got this page that allows one to select a language by means of a POST form. This language selection should obviously be retained throughout the entire session. I know that HTTP POST headers are overwritten by existing session data, hence the use of temporary variables.
$lid (language id) is POSTed by the form, $sc_lid (session constant language id) is the correspondant value in a MySQL database. I'm using Ying Zhang's Custom Session Handler toolkit to this purpose.
<pre>
// new language selected but one already set in this sesion?
// unregister it so that we can register a new language
if (isset($lid) && session_is_registered("sc_lid")) session_unregister("sc_lid");
// we want a global language session constant
session_register("sc_lid");
// we just unregistered the previous language, now register the new one
if (isset($lid)) { $sc_lid = $lid; }
// we don't want a new language, use the current one
// or use and retain the default language (1)
else { $lid = isset($sc_lid) ? $sc_lid : $sc_lid = 1; }
</pre>
This unfortunately does not work due to reasons that are quite beyond me. Who knows why and can put me back on track? Once again, it would be greatly appreciated.
TIA,
Roderick van Domburg
ICQ UIN 7798700