MOD download & history

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 Niels on Thu 12. Sep, 2002 23:49

Last visit PART 4, nw updated to ver 0.9.2.
here are how-to upgrade

in file sessions.php
Code: Select all
[FIND]
,  user_totallogon=user_totallogon+1, user_totaltime=user_totaltime+".$board_config['session_length']."

[REPLACE WITH]
,  user_totallogon=user_totallogon+1
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Mon 16. Sep, 2002 15:47

The PART 4, have now changed, new version is 0.9.3, I have posted some wrong code in thee usercp_viewprofile.php

here are how to upgrade:
in file usercp_viewprofile.php
Code: Select all
[FIND]
'L_TOTAL_ONLINE_TIME' => $lang['Total_online_time'],
'TOTAL_ONLINE_TIME' => ($userdata['user_totaltime']) ? $userdata['user_totaltime']:'',
'L_LAST_ONLINE_TIME' => $lang['Last_online_time'],
'LAST_ONLINE_TIME' => ($userdata['user_lastlogon']&& $userdata['user_session_time']) ? date('H:i',$userdata['user_session_time']-$userdata['user_lastlogon']): $lang['None'],
'L_NUMBER_OF_VISIT' => $lang['Number_of_visit'],
'NUMBER_OF_VISIT' => ($userdata['user_totallogon']) ? $userdata['user_totallogon']: $lang['None'],
Code: Select all
[REPLACE WITH]
'L_TOTAL_ONLINE_TIME' => $lang['Total_online_time'],
'TOTAL_ONLINE_TIME' => make_hours($profiledata['user_totaltime']),
'L_LAST_ONLINE_TIME' => $lang['Last_online_time'],
'LAST_ONLINE_TIME' => make_hours($profiledata['user_session_time']-$profiledata['user_lastlogon']),
'L_NUMBER_OF_VISIT' => $lang['Number_of_visit'],
'NUMBER_OF_VISIT' => ($profiledata['user_totallogon']>0) ? $profiledata['user_totallogon']: $lang['None'],
Last edited by Niels on Mon 23. Sep, 2002 08:27, edited 1 time in total.
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Mon 16. Sep, 2002 16:03

There was a typo in PART 4, new version is 0.9.4.
The [IN-LINE FIND] was not uniqe in the line, therefor if you have a "Error in your SQL synax" after this mod, then please follow these steps

here are how to upgrade
In file session.php
Code: Select all
[FIND]
$sql = "UPDATE " . USERS_TABLE . " , user_totallogon=user_totallogon+1
   SET user_session_time

[REPLACE WITH]
$sql = "UPDATE " . USERS_TABLE . "
   SET user_session_time

[IN-LINE, FIND]
#
#-----[ IN-LINE FIND ]------------------------------------------
#
time() .  "

[IN_LINE AFTER, ADD]
, user_totallogon=user_totallogon+1
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Wed 18. Sep, 2002 21:10

I have on request included into PART 4 a counter, witch count how meny "page hits" the user have had, the counter are updated when ever the user switches a page (the counter wil be more accurate, if the DETAILED WHOISONLINE mod is installed aswell)

here are how to upgrade

Code: Select all
#
#-----[ ADD SQL ]------------------------------------------
#
ALTER TABLE users ADD user_totalpages INT (11) not null

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
$lang['Number_of_visit'] = 'Number of visits';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Number_of_pages'] = 'Number of page hits';

#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php

#
#-----[ FIND ]------------------------------------------
#
if ( $userdata['user_id'] != ANONYMOUS )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_totaltime=user_totaltime+($current_time-user_session_time), user_session_time = $current_time, user_session_page = $thispage_id, user_session_topic = '".$thistopic_id ."'
WHERE user_id = " . $userdata['user_id'];

#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_totaltime=user_totaltime+

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
user_totalpages=user_totalpages+1,

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#
'NUMBER_OF_VISIT' => ($profiledata['user_totallogon']) ? $profiledata['user_totallogon']: $lang['None'],

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

'L_NUMBER_OF_PAGES' => $lang['Number_of_pages'],
'NUMBER_OF_PAGES' => ($profiledata['user_totalpages']) ? $profiledata['user_totalpages']: $lang['None'],


#
#-----[ OPEN ]------------------------------------------
#  (make sure to edit this file for every theme you use).
templates/subsilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<!-- END switch_user_is_moderator -->

#
#-----[ BEFORE, ADD ]------------------------------------------
#
<tr>
  <td valign="middle" align="right"><span class="gen">{L_NUMBER_OF_PAGES}:&nbsp;</span></td>
  <td width="100%"><b><span class="gen">{NUMBER_OF_PAGES}</span></b></td>
</tr>
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Mon 23. Sep, 2002 09:21

I did made one more typo in the how-to PART 4, new version is 0.9.6.
here are how to correct this:

Code: Select all
##remember to include your prefix in-front of "users"
e.g. phpbb_users
#
#[ADD SQL]
#
ALTER TABLE users CHANGE user_totalpages user_totalpages INT(11) DEFAULT '0' NOT NULL


in usercp_viewprofile.php
Code: Select all
#
#[FIND]
#
'NUMBER_OF_PAGES' => ($userdata['user_totalpages']) ? $userdata['user_totalpages']: $lang['None'],


Code: Select all
#
#[REPLACE WITH]
#
'NUMBER_OF_PAGES' => ($profiledata['user_totalpages']) ? $profiledata['user_totalpages']: $lang['None'],
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Fri 18. Oct, 2002 16:59

This topic could be of interest of some of the users, using this mod

http://www.phpbb.com/phpBB/viewtopic.php?t=46040

it explain how to modify the statistics.php so you can see witch users have spend most time on the forum
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Sat 02. Nov, 2002 16:01

in ver. 0.96 of the how-to was missing page count, if you have followed a previous upgrade instruction 2 post above, then some of the code into session.php may already have been done.

I have upgraded the part 1/part 4, to allow guest users being counted aswell + fixed the how-to so the page count are included

here are how-to upgrade 0.9.5/0.9.6 -> 0.9.7

PART 1 now ver 1.2.4
in file index.php
Code: Select all
[FIND]
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_lastlogon >= '.$timetoday.' AND user_lastlogon< '.($timetoday+86399).' ORDER BY username';

[REPLACE WITH]
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' ORDER BY username';


PART 4 now ver 0.9.7
in file session.php
Code: Select all
#
#-----[ FIND ]------------------------------------------
#
if ( $user_id != ANONYMOUS )
{
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;
$sql = "UPDATE " . USERS_TABLE . "
   SET user_session_time

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

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

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

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

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

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

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

#
#-----[ FIND ]------------------------------------------
#
if ( $userdata['user_id'] != ANONYMOUS )
{
$sql = "UPDATE " . USERS_TABLE . "

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

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

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

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

#
#-----[ IN-LINE FIND ]------------------------------------------
#
SET

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


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

//
// Delete expired sessions

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

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


if in doubt these changes can be seenin the session.php in the pre-loaded pack
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby Niels on Sun 05. Jan, 2003 16:18

minor speed improvement into the code at index.php
also all usernames was in bold, by default phpbb shows only MOD and ADMIN in bold - now corrected
new version on PART 1 is now 1.2.5

here are how to update
in file index.php
Code: Select all
[FIND]
//show dayly users mod
$current_time=time();
$time1Hour=$current_time-3600;
$minutes = date('is', $current_time);
$hour_now = $current_time - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]);
$dato=create_date('H', $current_time,$board_config['board_timezone']);
$timetoday = $hour_now - (3600*$dato);
$sql = 'SELECT session_ip, MAX(session_time) as session_time FROM '.SESSIONS_TABLE.' WHERE session_user_id="'.ANONYMOUS.'" AND session_time >= '.$timetoday.' AND session_time< '.($timetoday+86399).' GROUP BY session_ip';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve guest user today data", "", __LINE__, __FILE__, $sql);
while( $guest_list = $db->sql_fetchrow($result))
{
   if ($guest_list['session_time'] >$time1Hour) $users_lasthour++;
}
$guests_today = $db->sql_numrows($result);
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' ORDER BY username';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);
while( $todayrow = $db->sql_fetchrow($result))
{
   $style_color = "";
   if( $todayrow['user_level'] == ADMIN )
   {
      $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
      $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
   }
   else if( $todayrow['user_level'] == MOD )
   {
      $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
      $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
   }
if ($todayrow['user_lastlogon']>=$time1Hour)
{
   $users_lasthour++;
}
   $users_today_list .= ($users_today_list&& ($todayrow['user_allow_viewonline'] || $userdata[user_level]==ADMIN))? ', ':'';
   $users_today_list.=( $todayrow['user_allow_viewonline'])?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><b>' . $todayrow['username'] . '</b></a>':(($userdata[user_level]==ADMIN)?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><i>' . $todayrow['username'] . '</i></a>':'');
   if (!$todayrow['user_allow_viewonline']) $logged_hidden_today++;
   else $logged_visible_today++;
}
$total_users_today = $db->sql_numrows($result)+$guests_today;
if ( empty($total_users_today) )
{
   $users_today_list = $lang['None'];
}
$users_today_list = $lang['Registered_users'].' ' . $users_today_list;
$l_today_user_s = ($total_users_today) ? ( ( $total_users_today == 1 )? $lang['User_today_total'] : $lang['Users_today_total'] ) : $lang['Users_today_zero_total'];
$l_today_r_user_s = ($logged_visible_today) ? ( ( $logged_visible_today == 1 ) ? $lang['Reg_user_total'] : $lang['Reg_users_total'] ) : $lang['Reg_users_zero_total'];
$l_today_h_user_s = ($logged_hidden_today) ? (($logged_hidden_today == 1) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total'] ) : $lang['Hidden_users_zero_total'];
$l_today_g_user_s = ($guests_today) ? (($guests_today == 1) ? $lang['Guest_user_total'] : $lang['Guest_users_total']) : $lang['Guest_users_zero_total'];
$l_today_users = sprintf($l_today_user_s, $total_users_today);
$l_today_users .= sprintf($l_today_r_user_s, $logged_visible_today);
$l_today_users .= sprintf($l_today_h_user_s, $logged_hidden_today);
$l_today_users .= sprintf($l_today_g_user_s, $guests_today);


[REPLACE WITH]
//show dayly users mod
$time_now=time();
$time1Hour=$time_now-3600;
$minutes = date('is', $time_now);
$hour_now = $time_now - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]);
$dato=create_date('H', $time_now,$board_config['board_timezone']);
$timetoday = $hour_now - (3600*$dato);
$sql = 'SELECT session_ip, MAX(session_time) as session_time FROM '.SESSIONS_TABLE.' WHERE session_user_id="'.ANONYMOUS.'" AND session_time >= '.$timetoday.' AND session_time< '.($timetoday+86399).' GROUP BY session_ip';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve guest user today data", "", __LINE__, __FILE__, $sql);
while( $guest_list = $db->sql_fetchrow($result))
{
   if ($guest_list['session_time'] >$time1Hour) $users_lasthour++;
}
$guests_today = $db->sql_numrows($result);
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' ORDER BY username';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);
while( $todayrow = $db->sql_fetchrow($result))
{
   $style_color = "";
   if ($todayrow['user_lastlogon']>=$time1Hour)
   {
      $users_lasthour++;
   }
   switch ($todayrow['user_level'])
   {
      case ADMIN :
            $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
            $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
         break;
      case MOD :
            $todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
            $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
         break;
   }
   $users_today_list.=( $todayrow['user_allow_viewonline'])?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'>' . $todayrow['username'] . '</a>,' : (($userdata[user_level]==ADMIN) ? ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><i>' . $todayrow['username'] . '</i></a>,' : '');
   if (!$todayrow['user_allow_viewonline']) $logged_hidden_today++;
   else $logged_visible_today++;
}
if ($users_today_list)
{
   $users_today_list[ strlen( $users_today_list)-1] = ' ' ;
} else
{
   $users_today_list = $lang['None'];
}
$total_users_today = $db->sql_numrows($result)+$guests_today;

$users_today_list = $lang['Registered_users'].' ' . $users_today_list;
$l_today_user_s = ($total_users_today) ? ( ( $total_users_today == 1 )? $lang['User_today_total'] : $lang['Users_today_total'] ) : $lang['Users_today_zero_total'];
$l_today_r_user_s = ($logged_visible_today) ? ( ( $logged_visible_today == 1 ) ? $lang['Reg_user_total'] : $lang['Reg_users_total'] ) : $lang['Reg_users_zero_total'];
$l_today_h_user_s = ($logged_hidden_today) ? (($logged_hidden_today == 1) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total'] ) : $lang['Hidden_users_zero_total'];
$l_today_g_user_s = ($guests_today) ? (($guests_today == 1) ? $lang['Guest_user_total'] : $lang['Guest_users_total']) : $lang['Guest_users_zero_total'];
$l_today_users = sprintf($l_today_user_s, $total_users_today);
$l_today_users .= sprintf($l_today_r_user_s, $logged_visible_today);
$l_today_users .= sprintf($l_today_h_user_s, $logged_hidden_today);
$l_today_users .= sprintf($l_today_g_user_s, $guests_today);
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

PreviousNext

Return to Last visit [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 0 guests

cron