Get Session Information When Using Cdbhttpsession

Assuming I use CDbHttpSession, how do I get data from the session from inside the class, for example the userID? The openSession function does something like:


$sql="DELETE FROM {$this->sessionTableName} WHERE expire<".time();

Can I presume this is responsible for deleting the expired sessions?

Is there any way to know for which user I have deleted the session when this function is called, so I can log this action to the database?

you cannot do that (at least theoreticaly) because you could also alter sessions of other users.

How could I log when a user’s session is destroyed and what the user’s id is? Any ideas? I basically want to log when a user is logged out because of a session timeout.

Hi,

I hope my reply in this link would help you out. http://www.yiiframework.com/forum/index.php/topic/12056-doing-special-actoin-on-session-close-expire/