user-defined session handlers. I'll start with how I have set up the
handlers, please correct the process if it is wrong:
-- BOF --
function sess_open($save_path, $session_name) {
// open a database connection
}
function sess_close() {
// close the database connection
}
function sess_read($id) {
// return data from saved record in db
}
function sess_write($id, $sess_data) {
// write $sess_data to record in db
}
function sess_destroy($id) {
// delete record from db
}
function sess_gc($maxlifetime) {
// delete expired records from db
}
session_module_name('user');
session_set_save_handler(
'sess_open', 'sess_close', 'sess_read', 'sess_write',
'sess_destroy', 'sess_gc'
);
session_start();
// php code for page goes here
-- EOF --
Doing things that way, everything seems to work.. sorta.. one major
exception, though:
function redirect_page($url){
session_write_close();
header("Location: ${url}");
exit();
}
session_write_close() does not call my sess_write() routine. Instead it
seems to be using PHP's default files method every time.
Because of this, I am forced to call my lower-level routine directly:
sess_write(session_id(), serialize($_SESSION));
This works as a work-a-round, but I would much rather use PHP's
pre-defined session_write_close(). Is this a bug or am I doing something
wrong?
Mike
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php