Author Topic: Add users browser and operating system to your site log  (Read 6668 times)

AF

  • Prime Member
  • ****
  • Posts: 117
  • Karma: +3/-2
Re: Add users browser and operating system to your site log
« Reply #15 on: September 29, 2015, 10:25:41 PM »
Please correct me if I am wrong.

For the user_functions.inc.php - he says: INSERT after it (before the last  } )



Code: [Select]
if (USE_DB_SESSIONS==0) {
$now=gmdate('YmdHis');
$query="UPDATE `{$dbtable_prefix}online` SET `last_activity`='$now' WHERE `fk_user_id`=$user_id AND `sess`='".session_id()."'";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
if (!mysql_affected_rows()) {
$query="REPLACE INTO `{$dbtable_prefix}online` SET `fk_user_id`=$user_id,`sess`='".session_id()."',`last_activity`='$now'";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
}
****this is before the last (}) (meaning place he code here right? - Wrong - I had to place the code AFTER the last (})***
}
*** this is after, so code goes here instead ***





Thank you Flyer5 very much for this code contribution!! If there is a way to also display the Browser Versions that would be awesome!

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1006
  • Karma: +56/-7
Re: Add users browser and operating system to your site log
« Reply #16 on: September 29, 2015, 11:23:15 PM »
I added this to a live site and it's working perfectly. maybe you should try it too.
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

AF

  • Prime Member
  • ****
  • Posts: 117
  • Karma: +3/-2
Re: Add users browser and operating system to your site log
« Reply #17 on: September 30, 2015, 12:47:01 AM »
I added this to a live site and it's working perfectly. maybe you should try it too.

Activity log is working great.
Now I'm actually trying to get this to work on the "Live Site Activity" ... I updated live_action.html,  live_action.php, live_action.js, latest_logs.php.

All the data seems to get passed to the correct places, but the script stops. If I manually reload Live Site Activity then it all appears fine but wont automatically show new pages i browse.

Have you tried it on the Live Site Activity yet?

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1006
  • Karma: +56/-7
Re: Add users browser and operating system to your site log
« Reply #18 on: October 01, 2015, 12:54:06 AM »
I added this to a live site and it's working perfectly. maybe you should try it too.

Activity log is working great.
Now I'm actually trying to get this to work on the "Live Site Activity" ... I updated live_action.html,  live_action.php, live_action.js, latest_logs.php.

All the data seems to get passed to the correct places, but the script stops. If I manually reload Live Site Activity then it all appears fine but wont automatically show new pages i browse.

Have you tried it on the Live Site Activity yet?

I only followed these instructions on adding this to the Activity Log. I didn't try to add it to the Live Activity. If you are unable to get it to work, then there might be a reason why flyer5 only made this for the Activity Log.
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.