sessions.php / Error updating last visit time

This mod will register when the user last logged in, allong with the info about how meny users have visited the board

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Postby Peter77s on Sun 24. Jul, 2005 23:04

Make sure your board is up to date with latest version.



I didn't comment out some code in sessions.php .. seemed to work for me.



If I had a chance to do this MOD overs I would not do it. not worth the trouble. :!:
Peter77s
Poster
Poster
 
Posts: 34
Joined: Sat 26. Mar, 2005 19:46

Postby mosax on Wed 17. Aug, 2005 00:58

Die Datei, die funktiontionieren sollte:
Here the mod without the install-bug:
mosax
Poster
Poster
 
Posts: 1
Joined: Sun 31. Jul, 2005 13:27

Postby Wizard Of Odd on Mon 22. Aug, 2005 12:59

Is this right?

I can see all this extra info on peoples profiles -

Image

But all my users can see id the last visit time. Not all the other extra info like total duration etc. Is that how it's supposed to be?
Wizard Of Odd
Poster
Poster
 
Posts: 2
Joined: Sun 21. Aug, 2005 17:13

Postby 3Di on Tue 23. Aug, 2005 14:08

Wizard Of Odd wrote:Is this right?

I can see all this extra info on peoples profiles -


But all my users can see id the last visit time. Not all the other extra info like total duration etc. Is that how it's supposed to be?


yes, only admin and moderators can.
Image
3Di
Poster
Poster
 
Posts: 4
Joined: Mon 06. Jun, 2005 21:40
Location: 3D Land

EasyMOD with Last Visit: Solution

Postby Niksa on Sat 27. Aug, 2005 21:16

I hope this will help anyone who still is having trouble installing this mod. I had the same problem so I am posting what I did to fix it:

I got this error in EasyMOD with a 2.0.17 forum.

Code: Select all
Critical Error

FIND FAILED: In file [includes/sessions.php] could not find:

if (
{// (
$last_visit = (
$sql = "UPDATE " . USERS_TABLE . "
SET

MOD script line #509 :: FAQ :: Report


So I opened sessions.php and my code for the above referenced lines looked like this:
Code: Select all
   if ( $user_id != ANONYMOUS )
   {// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
      $last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;

      if (!$admin)
      {
         $sql = "UPDATE " . USERS_TABLE . "
            SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
            WHERE user_id = $user_id";
         if ( !$db->sql_query($sql) )
         {
            message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
         }
      }

      $userdata['user_lastvisit'] = $last_visit;

      $sessiondata['autologinid'] = (!$admin) ? (( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '') : $sessiondata['autologinid'];
      $sessiondata['userid'] = $user_id;
   }


As per instructions in the install file, my code turned into this:

Code: Select all
   //if ( $user_id != ANONYMOUS )
   //{// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
      $last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;

      if (!$admin)
      {
         $sql = "UPDATE " . USERS_TABLE . "
            SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit, user_lastlogon = " . time() .  ", user_totallogon=user_totallogon+1
            WHERE user_id = $user_id";
         if ( !$db->sql_query($sql) )
         {
            message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
         }
      }

      $userdata['user_lastvisit'] = $last_visit;

      $sessiondata['autologinid'] = (!$admin) ? (( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '') : $sessiondata['autologinid'];
      $sessiondata['userid'] = $user_id;
   //}


And then I proceeded to do the rest of the edits in sessions.php as instructed. This seems to have worked for me so far.

Hopefully this is somewhat helpful to use as a reference, but unfortunately you will have to open up sessions.php and do the changes manually for this file. Always make a backup... :wink:

If this is NOT the way to solve the error, please let me know also, of course! :lol:
Niksa
Poster
Poster
 
Posts: 6
Joined: Sat 15. May, 2004 07:39

Postby theangryone on Mon 29. Aug, 2005 08:13

hi, i get this error now

Code: Select all
Critical Error

FIND FAILED: In file [templates/subSilver/index_body.tpl] could not find:

{NEWEST_USER}</span>
</td>
</tr>

MOD script line #764 :: FAQ :: Report
theangryone
Poster
Poster
 
Posts: 1
Joined: Sat 09. Jul, 2005 05:31

Postby NorthernMike on Wed 26. Oct, 2005 15:45

I am getting this error and it is driving me crazy. I am not new to this. I have been installing mods for 2 years now but I can't figure this one out.

Code: Select all
phpBB : Critical Error

Error updating last visit time

DEBUG MODE

UPDATE phpbb_users SET user_session_time = 1130327827, user_session_page = 0, user_lastvisit = 1130327426, user_lastlogon = 1130327827, user_totallogon=user_totallogon+1 WHERE user_id = 2

Line : 189
File : sessions.php

Here is my code in "sessions.php" that I think may be incorrect.

Code: Select all
//if ( $user_id != ANONYMOUS )
{// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;

$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
WHERE user_id = $user_id";
//if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating last visit time', '', __LINE__, __FILE__, $sql);
//}

$userdata['user_lastvisit'] = $last_visit;

$sessiondata['autologinid'] = ( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '';
$sessiondata['userid'] = $user_id;
//}


Please any help would be greatly appreciated.
NorthernMike
Poster
Poster
 
Posts: 5
Joined: Mon 24. Oct, 2005 17:41

Postby Peter77s on Mon 31. Oct, 2005 11:41

Im back. I wonder if this MOD is compatible with 2.0.18?

I just upgraded my board with easy mod and now I have the same problem. not sure if it's this mod fault. :?:
Peter77s
Poster
Poster
 
Posts: 34
Joined: Sat 26. Mar, 2005 19:46

Previous

Return to Last visit [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron