Friday 22 August 2003 3:04:53 pm
An update to my own question here. Not sure if this is the best way, but it works. I have added the code below to index.php. I check for a new session, and on the first link into the application I look for querystring values. If found, I store them as session variables and in a custom table I created (not sure which ones I want to use yet). $mysessionstarted = $http->sessionVariable( "mysessionstarted" );
if (!$mysessionstarted ) {
// Look for User GUID
if ( $http->hasGetVariable( "uguid" ) )
{ $userguid = $HTTP_GET_VARS["uguid"]; } else { $userguid= "0"; }
// Look for U.S. State
if ( $http->hasGetVariable( "state" ) )
{ $userstate = $HTTP_GET_VARS["state"]; } else { $userstate = "UNKNOWN"; }
// Look for Department
if ( $http->hasGetVariable( "department" ) )
{ $userdepartment = $HTTP_GET_VARS["department"]; } else { $userdepartment = "UNKNOWN"; }
// Set session variables
$http->setSessionVariable( "userguid", $userguid );
$http->setSessionVariable( "userstate", $userstate ); $http->setSessionVariable( "userdepartment", $userdepartment );
// Set other values needed to log the vist
$sessionid = $http->sessionID(); $accessdate = date("Y-m-d H:i:s");
// Set flag that the session has started $http->setSessionVariable( "mysessionstarted ", true );
// Run update to log the user session. Note that this is a bit redundant in that
// EZ logs the session in ezsession. The complexity with the default is that ALL
// session variables in ezsession are stored in a delimited string (the data field).
// These values are harder to examine and extract than in our dedicated table. // Plus, the ezsession table is a working table, so it gets flushed.
// Start a new transaction $db->begin();
// Send SQL
$db->query("INSERT INTO ezloginhistory ( session_id, uguid, state, department, access_date ) VALUES ( '$sessionid', '$userguid', '$userstate', '$userdepartment', '$accessdate' )" );
// Commit the transaction $db->commit();
/*
// test out fetching data back by SessionID
$rows =& $db->arrayQuery( "SELECT * FROM ezloginhistory WHERE session_id = '$sessionid'" );
foreach ( $rows as $row )
{ print( $row["state"] ); } */ }
DUO : CONSULTING
Web content management experts
www.duoconsulting.com
|