LAST VISIT MOD FULLY WORKING VERSION FOR PHPBB 2.0.18

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 !

LAST VISIT MOD FULLY WORKING VERSION FOR PHPBB 2.0.18

Postby acoolwelshbloke on Sun 06. Nov, 2005 19:37

I have re-written this so it works with the latest release of phpBB V2.0.18....

I have made three changes to this MOD and they are:
  • Re-coded memberlist.php
  • Re-coded sessions.php
  • Cleaned up the english install.txt file
I have re-named this mod with the version name 1.2.9 beta so people do not get confused with the original MOD which works on phpBB versions 2.0.17 and under.

**********UPDATE**********

These are the changes you need to make to your sessions.php:
Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#
includes/sessions.php

#
#-----[ FIND ]------------------------------------------------
#
if ( $user_id != ANONYMOUS )
{
    $last_visit = (

#
#-----[ IN-LINE FIND ]----------------------------------------
#
if

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
//

#
#-----[ IN-LINE FIND ]----------------------------------------
#
{

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
//

#
#-----[ IN-LINE FIND ]----------------------------------------
#
user_lastvisit = $last_visit

#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
, user_lastlogon = " . time() .  ", user_totallogon=user_totallogon+1

#
#-----[ FIND ]------------------------------------------------
#
$sessiondata['userid'] = $user_id;
}

#
#-----[ IN-LINE FIND ]----------------------------------------
#
}

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
//

#
#-----[ FIND ]------------------------------------------------
#
if ( !empty($session_id) )
{

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Start add - Last visit MOD
$expiry_time = $current_time - $board_config['session_length'] ;
// End add - Last visit MOD

#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT u.*, s.*
FROM
WHERE
AND

#
#-----[ IN-LINE FIND ]----------------------------------------
#
";

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
AND session_time > $expiry_time

#
#-----[ FIND ]------------------------------------------------
#
if ( $userdata['user_id'] != ANONYMOUS )
{
$sql =
SET

#
#-----[ IN-LINE FIND ]----------------------------------------
#
if

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
//

#
#-----[ IN-LINE FIND ]----------------------------------------
#
{

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
//

#
#-----[ FIND ]----------------------------------------
#
     message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
   }
}

#
#-----[ REPLACE WITH ]---------------------------------
#
      message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
    }
//}

#
#-----[ IN-LINE FIND ]----------------------------------------
#
$thispage_id

#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
, user_totalpages = user_totalpages+1, user_totaltime = user_totaltime+($current_time-".$userdata['session_time'].")

#
#-----[ FIND ]------------------------------------------------
#
}

//
// Delete expired sessions
//

#
#-----[ FIND ]------------------------------------------------
#
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
   WHERE session_time < ' . (time() - (int) $board_config['session_length']) . "
       AND session_id <> '$session_id'";

#
#-----[ REPLACE WITH ]--------------------------------
#
$sql = "DELETE FROM " . SESSIONS_TABLE . "
   WHERE UNIX_TIMESTAMP() - session_time >=172800
       AND session_id <> '$session_id'";


All the people who seem to post here with errors have them because they mess up the script when it comes to altering two parts of the code. So I will post these here so others who get error messages can check their script in these places to ensure the mod is or has been installed correctly.

The first one and most common error is because people do not apply this change:
Code: Select all
     message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
   }
}


Replace with:
Code: Select all
      message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
    }
//}


And finally the second cause of errors tends to be because the user has not correctly altered:
Code: Select all
//
// Delete expired sessions
//

#
#-----[ FIND ]------------------------------------------------
#
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
   WHERE session_time < ' . (time() - (int) $board_config['session_length']) . "
       AND session_id <> '$session_id'";

#
#-----[ REPLACE WITH ]--------------------------------
#
$sql = "DELETE FROM " . SESSIONS_TABLE . "
   WHERE UNIX_TIMESTAMP() - session_time >=172800
       AND session_id <> '$session_id'";


Remember to alter the section marked:
Code: Select all
   //
   // Delete expired sessions
   //


AND NOT the section marked:
Code: Select all
   //
   // Delete existing session
   //


as some of you have done!

I hope this helps... :wink:

**********END**********

You can download the Last Visit MOD V1.2.9 beta by clicking on the download link below.
Last edited by acoolwelshbloke on Tue 20. Dec, 2005 15:44, edited 12 times in total.
www.thegamersforums.com
<b><u>For All Your Gaming Needs!</u></b>
acoolwelshbloke
Poster
Poster
 
Posts: 66
Joined: Wed 02. Nov, 2005 15:09

Postby ichda on Sun 06. Nov, 2005 20:36

Thanx for this mod,but i doesn´t work ......sorry.

First i think it works fine but know my guest counter counts back......
ichda
Poster
Poster
 
Posts: 8
Joined: Sat 20. Aug, 2005 12:09

Postby acoolwelshbloke on Sun 06. Nov, 2005 22:03

Does work matey see www.thegamersforums.com I'm using it there on 2.0.18 without any problem... :wink:

You just done a mistake somewhere along the line!

Check through you code for the mistakes as I see from your posts you have had this problem prior to installing this code hense there is a problem in your code...
www.thegamersforums.com
<b><u>For All Your Gaming Needs!</u></b>
acoolwelshbloke
Poster
Poster
 
Posts: 66
Joined: Wed 02. Nov, 2005 15:09

Postby acoolwelshbloke on Sun 06. Nov, 2005 22:39

ichda

I have looked through your sessions.php and your code is all wrong that is why your having problems!

The sessions.php file you sent me is not even from phpbb 2.0.18 it is from an earlier version no wonder it don't work!

I sujest you find out what version you have and upgrade to version 2.0.18 and if you have upgraded then your using an incorrect version of sessions.php you will need to apply my code above to the sessions.php file from phpbb 2.0.18
www.thegamersforums.com
<b><u>For All Your Gaming Needs!</u></b>
acoolwelshbloke
Poster
Poster
 
Posts: 66
Joined: Wed 02. Nov, 2005 15:09

Postby cYbercOsmOnauT on Mon 07. Nov, 2005 03:36

I don't know why you guys don't read and understand the code written by the phpbb-coders. I now saw two different "solutions" for the problem with 2.0.18 and the Last Visit Mod. Both of them turn the new "Session Length"-Entry on the Configuration (ACP) to nonsense. Because (with your code) it doesn't matter what the admin writes in this field. The sessions get deleted after two days.

The 100% right solution is:
Code: Select all
#
#-----[ FIND ]------------------------------------------------
#
}

//
// Delete expired sessions
//

#
#-----[ FIND ]------------------------------------------------
#
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
   WHERE session_time < ' . (time() - (int) $board_config['session_length']) . "
       AND session_id <> '$session_id'";

#
#-----[ REPLACE WITH ]--------------------------------
#
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
   WHERE session_time < ' . (time() - (86400 * (int) $board_config['session_length']))) . "
       AND session_id <> '$session_id'";
All the coders forgot was to calculate the value of $board_config['session_length'] from days to seconds. Sorry when I sound a bit upset but I dislike solutions which disable functions without needing to do.

Cheers,
Tekin
Last edited by cYbercOsmOnauT on Mon 07. Nov, 2005 03:50, edited 1 time in total.
cYbercOsmOnauT
Poster
Poster
 
Posts: 4
Joined: Sun 06. Nov, 2005 13:01

Postby acoolwelshbloke on Mon 07. Nov, 2005 03:43

First of all you should be greatfull we take the time to do anything to get this to work.

It's not as if we get any thanks for it is it, or payed!

and as we stated this is a temp fix until the author looks at it and decides what it is he wants to do with it!

and second of all I can already see a problem with what you have done so I'm going to look at it further before I comment on it any further!

UPDATE:
THIS CODE HAS NOTHING TO DO WITH THE LAST VISIT MOD! THIS PART OF THE SCRIPT IS PUT IN PLACE BY PHPBB.......

WHAT THE HELL ARE YOU TALKING ABOUT?????

THE LAST VISIT MODE REPLACES THAT SCRIPT!

GO AND MOAN TO PHPBB ABOUT IT!

It really annoyes me when people come on here moaning and they know and do SFA to help just take, take & take and moan in the process!
Last edited by acoolwelshbloke on Mon 07. Nov, 2005 03:54, edited 1 time in total.
www.thegamersforums.com
<b><u>For All Your Gaming Needs!</u></b>
acoolwelshbloke
Poster
Poster
 
Posts: 66
Joined: Wed 02. Nov, 2005 15:09

Postby cYbercOsmOnauT on Mon 07. Nov, 2005 03:53

I am greatfull for it sure I am. And I know that none of us gets money for writing these mods or fixes or moderating the forums. Only thing that made me upset was the "solution" which showed me that the writer didn't understand what $board_config['sessoin_length'] contains. :)

Anyways.. it's almost 3am here.. I should go to bed :D
cYbercOsmOnauT
Poster
Poster
 
Posts: 4
Joined: Sun 06. Nov, 2005 13:01

Postby acoolwelshbloke on Mon 07. Nov, 2005 03:55

But the last visit mod replaces that script??????

if your using the last visit mod and you have it installed corectly then you should not have that script there????

You replace that script with the following when installing the last visit mod!

Code: Select all
//
// Delete expired sessions
//

#
#-----[ FIND ]------------------------------------------------
#
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
   WHERE session_time < ' . (time() - (int) $board_config['session_length']) . "
       AND session_id <> '$session_id'";

#
#-----[ REPLACE WITH ]--------------------------------
#
$sql = "DELETE FROM " . SESSIONS_TABLE . "
   WHERE UNIX_TIMESTAMP() - session_time >=172800
       AND session_id <> '$session_id'";


It is shown as:

Code: Select all
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
   WHERE session_time < ' . (time() - (int) $board_config['session_length']) . "
       AND session_id <> '$session_id'";

Prior to adding the mods script, This is how the guy's at PHPBB have written the code it has nothing to do with the last visit mod! You are telling people that this is wrong and it causes a problem with your sessions, if this is true then you need to inform PHPBB!

GO MOAN TO THEM!

(another one who thinks he knows everything!) :roll:

Just to add to this post I always welcome comments from others and advice when it is given in a positive way. After all that is how many mods are made even phpbb itself. I just get angry when people start shouting their opinion when they donate nothing to the author and when they fail to show any respect to people who try and help others for free!
www.thegamersforums.com
<b><u>For All Your Gaming Needs!</u></b>
acoolwelshbloke
Poster
Poster
 
Posts: 66
Joined: Wed 02. Nov, 2005 15:09

Next

Return to Last visit [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron