I need to log when a user last accessed particular areas of my site (a content type and some views pages), to do this I have added a block using PHP filter with the below code. This block is only visible on the required pages so I was hoping it would mean when a user accesses these pages it updates the users profile with the timestamp.
global $user;
$uid = $user->uid;
$node = content_profile_load(profile,$uid);
$pid = $node->nid;
$node = node_load($pid);
$changeLastAccess = mktime();
$node->field_changes_last_access[0]['value'] = $changeLastAccess;
node_save($node);
The problem is this date always shows the CURRENT time, not the time when a user was last on one of the pages on which the block is active. I am totally stumped...
EDIT: This was working all along, i had created the wrong CCK field type of "Date" rather than "Datestamp", changed this over and it works fine.