The easiest way is to create a Session model and point it to your
session table. Then you can use all the normal Model methods and
report on active sessions.

If you wanted more information about the session, you could go for a
more complex option (which is what I was researching tonight,
coincidentally) - and create a seperate, persistent Session History
table. You could pretty easily manage it by creating a wrapper class
to extend the stock CakeSession class, and change your session
configuration in core.php to point to the new session wrapper. Then
all you'd need to do is override selected session handler callbacks
(see around line 493 of the CakeSession class, or simply search for
the session_set_save_handler() function) to insert a record into the
Session History table at which point you could record whatever
additional information about the session that you wanted (IP address,
user agent, referrer, etc). And if you wanted to get fancy, or you
needed an audit trail for industry compliance (or whatever), you could
add child tables for login history (write a record when a user logins
in, and updates when they log out), and even page history (save a
record per page hit).

There might be a simpler way - I've been looking to see if there is a
"new session" attribute or method call somewhere that indicates if
this is a new session, because then you could simply use a
beforeFilter or afterFilter to do the same thing as above, without
writing the custom wrapper class.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to