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 !

Postby DVD_GR on Tue 20. Dec, 2005 03:40

you suggested me a code here
http://mods.db9.dk/viewtopic.php?t=7033 ... c&start=40
i tested it and did not work,and posted you a minor error,you could fix easily I believe!!
the weird thing is that the part is stucks exists :(
Thanks a lot for the heelp!
www.octech.gr forum of scientific overclocking
www.2821.gr/indexen.htm visit chania!!!
DVD_GR
Poster
Poster
 
Posts: 12
Joined: Fri 02. Dec, 2005 05:33

Postby Billy2423 on Tue 20. Dec, 2005 04:40

acoolwelshbloke, I downloaded your version from page 1 and installed it within new phpbb files on that test site and got the below error

Code: Select all
Parse error: parse error, unexpected '}' in /home/billy/public_html/test/phpBB2/includes/sessions.php on line 397

If I comment that out then I get the below error
Code: Select all
Fatal error: Call to a member function on a non-object in /home/billy/public_html/test/phpBB2/includes/sessions.php on line 134

I have gone over sessions.php 3 times to make sure it was as you said to do, but was there suppose to be something done with this code below or just pointing to the right place as it is wrong per new phpbb file.

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 ]--------------------------------

The code really is:
Code: Select all
/**
* Removes expired sessions and auto-login keys from the database
*/
function session_clean($session_id)
{
   global $board_config, $db;
       
   //
   // Delete expired sessions
Image
Billy2423
Poster
Poster
 
Posts: 16
Joined: Tue 27. Jan, 2004 00:47
Location: USA

Postby acoolwelshbloke on Tue 20. Dec, 2005 14:20

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'";

So you are saying the above code should be changed to:

Code: Select all
/**
* Removes expired sessions and auto-login keys from the database
*/
function session_clean($session_id)
{
   global $board_config, $db;
       
   //
   // Delete expired sessions


The above changes you have made reffer to the original scrip made my phpbb and if you think it should be altered or changed it should be posted at phpbb.com and not really here.

However please read on.

Well I stand by my original quote that you are the only one that did not get it to work. Nobody else on here has left with it not working. :wink:

I know why you got the first error as so many others did no doubt you left out // in a part of your script which may of caused further errors along the line.

The code you have applied there does not actually play a part in making this mod work????

It's more of an alteration to phpbb itself...

Anyway I see a possible problem with your script already!

Take a look at it's function and think about it for a second and see if you can spot the problem! :wink:

If you can't publish that script you added on phpbb.com or if you want come back here and i'll tell you. (But think about it first)

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:
Last edited by acoolwelshbloke on Tue 20. Dec, 2005 15:23, edited 4 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 acoolwelshbloke on Tue 20. Dec, 2005 14:31

DVD_GR wrote:you suggested me a code here
http://mods.db9.dk/viewtopic.php?t=7033 ... c&start=40
i tested it and did not work,and posted you a minor error,you could fix easily I believe!!
the weird thing is that the part is stucks exists :(
Thanks a lot for the heelp!


Hi can I ask who's sessions.php you tried?

Because feldon posted one and then after that failed I looked at your code and found several parts of your sessions.php had not been altered with the script for the last visit mod. So all I did was add them and post it.

Remeber my warning though, you said you had several other mods installed on your site and the last visit mod may not be compatible with them or at least one of them.

Changing the sessions.php with the script for one mod can alter and prevent another from working.

I'll go back over your posts and get back to you. :wink:
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 DVD_GR on Tue 20. Dec, 2005 15:56

thanks my friend you rule at php.(offtopic your site is gr8!!!)
I tried your sessions.php and you fixed some things but it was a minor problem tha kept it from workink :(,
I searched all the other mods I installed and fortunately they did not alter sessions php (EasyMOD 0.3.0 View All Posts Sorted By Time 1.0.0 by pentapenguin - Separate Announcements & Sticky 2.0.0 by Aiencran and ImageShack Mod )
www.octech.gr forum of scientific overclocking
www.2821.gr/indexen.htm visit chania!!!
DVD_GR
Poster
Poster
 
Posts: 12
Joined: Fri 02. Dec, 2005 05:33

Postby Billy2423 on Tue 20. Dec, 2005 16:12

acoolwelshbloke,
If u download your zip from the first page the below instructions are missing and that is why it did not work for me. I just did that on my test site and now yours works.
Find:
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);
    }
//}

Now yours is the same as mine except that i did not do
Code: Select all
#-----[ REPLACE WITH ]--------------------------------
#
$sql = "DELETE FROM " . SESSIONS_TABLE . "
   WHERE UNIX_TIMESTAMP() - session_time >=172800
       AND session_id <> '$session_id'";

as i tried it both ways and did not really see a differance that it made from the orginal phpbb part.
The below is from your last_visit_1.2.9beta.txt which does not have the above code in it :wink:
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 ]---------------------------------
#
//

#
#-----[ 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'";

#
#-----[ OPEN ]------------------------------------------------
Image
Billy2423
Poster
Poster
 
Posts: 16
Joined: Tue 27. Jan, 2004 00:47
Location: USA

Postby acoolwelshbloke on Tue 20. Dec, 2005 17:38

Billy I just downloaded it and they are there.......

However there was a previouse zip file there and they were not in that file hense the reason for the updated version dated the 16-12-05 (I think that was the date).

You must have the old zip file.

Download it from page 1 and you will see them in the install file. :wink:

If you alter the code your way you are going to have problems with your phpbb.

Feel free to try it though!
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 Billy2423 on Tue 20. Dec, 2005 18:03

Hmmm, I downloaded that zip yesterday to try it on a fresh install of phpbb v2.0.18 and that code was not in there.. :?

If you alter the code your way you are going to have problems with your phpbb.

I do not understand what your saying cause the code is really the same as yours except that i did not do the
Code: Select all
$sql = "DELETE FROM " . SESSIONS_TABLE . "
   WHERE UNIX_TIMESTAMP() - session_time >=172800
       AND session_id <> '$session_id'";

I will be checking this out further with my friend who IS a programer to see if there is anything wrong with this..
We both seam to be around to help people and with that I wish you and family, Happy Holidays..
Image
Billy2423
Poster
Poster
 
Posts: 16
Joined: Tue 27. Jan, 2004 00:47
Location: USA

PreviousNext

Return to Last visit [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron