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
**********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...
**********END**********
You can download the Last Visit MOD V1.2.9 beta by clicking on the download link below.

