@baz - I think thats the idea. The current session information isn't
persistent or easily accessible. If you create a persistent session
log, you can attach anything you want to it, and save and query it at
will.

@chessjoe - I was doing some more work on this last night and this
morning. I'm thinking about making a WebLog component that
encapsulates session log, user log (login/logout and any other actions
you'd want to keep a transaction log of) and page logs. I want to see
when the session is started compared to when components are created.
Then the WebLog component could have some simple methods like
newSession(), saveSessionLog(), saveUserLog(), etc.

For the moment, I modified the above code somewhat, and instead of
simply setting a sessionExists flag, I actually have it setting the ID
of the persistent session history record attached. I have a data model
called SessionLog for a table that stores a machine generated key, the
cake/php-generated session string, user agent, remote address,
referrer, etc. So if its a new session, it saves a new record to the
SessionLog and sets the key - so that later, if I wanted to save a
user log record or page log record (or anything else I wanted a
transaction log tied to the session information for), I could link it
to the session log record.

function afterFilter() {


        // Check to see if the session exists
        if ( !$this->Session->read('Session.session_log_id') ) {

                loadModel('SessionLog');
                $slog = new SessionLog();

                // Set whatever data you want to save in the session
log here ...

                $slog->save();
                $sessionLogID = $slog->getInsertID();

                $this->Session->write('Session.session_log_id',
$sessionLogID);

                // Do other custom session operations here ...

        }
}

--~--~---------~--~----~------------~-------~--~----~
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