Seite 1 von 1
Last Visit-Anzeige im Adminbereich
Verfasst: 24.08.2003 16:04
von theMomo
Ich würde gern die Daten wieviele und welche User heut einsgesamt die Seite besucht haben, und wieviele in der Stunde im Adminbereich statt auf der Startseite anzeigen lassen. Was muss ich dazu ändern?
Verfasst: 24.08.2003 17:53
von Acid
Die Eintragungen in index.php/index_body.tpl in die gleichnamigen Dateien vom Adminbereich machen !?
Poste mal die Änderungen an den Dateien..
So ähnlich
Verfasst: 24.08.2003 18:02
von theMomo
habe ich das schon probiert, hab mich wohl aber trottelig angestellt, weil ich nicht ganz weiß, wo ich die Sachen aus der index.php in die admin/index.php reinstelle.
Im Original solls so sein
Code: Alles auswählen
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
$template->set_filenames(array(
"body" => "admin/index_body.tpl")
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//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);
#
#-----[ FIND ]------------------------------------------
#
"L_WELCOME" => $lang['Welcome_phpBB'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#
"USERS_TODAY_LIST" => $users_today_list,
"L_USERS_LASTHOUR" =>($users_lasthour)?sprintf($lang['Users_lasthour_explain'],$users_lasthour):$lang['Users_lasthour_none_explain'],
"L_USERS_TODAY" =>$l_today_users,
Und den Aufruf gibts in der index_body.tpl
mit
Code: Alles auswählen
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1" nowrap="nowrap">{L_NUMBER_USERS}:</td>
<td class="row2"><b>{NUMBER_OF_USERS}</b></td>
<td class="row1" nowrap="nowrap">{L_USERS_PER_DAY}:</td>
<td class="row2"><b>{USERS_PER_DAY}</b></td>
</tr>
#
#-----[ BELOW ADD ]------------------------------------------
#
<tr>
<td colspan="4" class="row1" align="left"><span class="gensmall">{L_USERS_TODAY} {L_USERS_LASTHOUR}<br />{USERS_TODAY_LIST}</br></span></td>
</tr>
Kannst Du damit was anfangen?
Verfasst: 24.08.2003 18:24
von Acid
Ich hab deinen Beitrag ma editiert... versuch´s ma so.