I've spend several days, I've searched a lot, here and via Bing I've fully explored OFFICIAL PHP page at: http://php.net/manual/en/ref.session.php
-- All comments, all functions.
But NOTHING HELPED. ABSOLUTE.
There's only one thing I need:
Invoke some function after SESSION is closed (for example, user has closed his browser).
Here is the point: AGAIN --- Invoke some function after user closed agent --- i.e session ID doesn't valid anymore
So, I've tried, to use old-style approach i.e override default session handler:
via,
session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc");
that something looks like this:
function sess_close() {
print "Session closed.
";
return true;
}
function sess_read($sess_id) {
print "Session read.
";
print "Sess_ID: $sess_id
";
return '';
}
function sess_write($sess_id, $data) {
print "Session value written.
";
print "Sess_ID: $sess_id
";
print "Data: $data
";
return true;
}
function sess_destroy($sess_id) {
print "Session destroy called.
";
return true;
}
function sess_gc($sess_maxlifetime) {
print "Session garbage collection called.
";
print "Sess_maxlifetime: $sess_maxlifetime
";
return true;
}
But this also doesn't work when a user closes browser. Why this doesnt work?