Seite 1 von 1
WER war WANN zuletzt online NUR für Admins sichtbar?
Verfasst: 08.04.2008 22:41
von Marius9
Nabend allerseits!^^
Nun, ich hätte da mal ein Fräge, undzwar ,,geht es, dass nur Admins sehen können, wann wer zuletzt im Board war?''
Habe PHP 2.0.x, habe allerdings nur n' Mod für PHP 3 gefunden.
Gibt's den auch für den Zweier?
Und kann man es so einstellen, dass
nur der Admin es sehen kann?
Alle anderen User sollen es also nicht sehen können...
Ich bedanke mich schonmal im Vorraus für eure Antworten! Bis bald!

Verfasst: 09.04.2008 19:12
von Gumfuzi
Hier ein alter Code von mir, der ich mal früher benutzt hatte:
(sorry fürs lange Posting, kann mom nicht uppen)
wer_war_hier.php
Code: Alles auswählen
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$page_title = 'Wer war hier';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array('body' => 'wer_war_hier.tpl'));
$r = 3;
$a = 1;
$user_today_text['count_user'] = 'Heute waren bisher <b>{COUNT_USER_TODAY}</b> registrierte User online.';
$user_today_text['zuletzt_um'] = 'zuletzt um';
$user_today_text['no_user'] = 'Heute war bisher kein registrierter User online.';
$mitternacht = mktime(0,0,0,date('m'),date('d'),date('Y'));
$result = $db->sql_query('Select `user_id`, `username`, `user_session_time`, `user_level` FROM '.USERS_TABLE." WHERE `user_session_time` > $mitternacht ORDER BY `user_session_time` DESC");
while( $row = $db->sql_fetchrow($result))
{
$user_today .= '<a href="'.append_sid('profile.php?mode=viewprofile&u='.$row['user_id']).'"';
$user_today .= ($row['user_level'] == 1) ? ' style="color: #'.$theme['fontcolor3'].'"><b>'.$row['username'].'</b></a>' : '';
$user_today .= ($row['user_level'] == 2) ? ' style="color: #'.$theme['fontcolor2'].'"><b>'.$row['username'].'</b></a>' : '';
$user_today .= ($row['user_level'] != 1 && $row['user_level'] != 2) ? '">'.$row['username'].'</a>' : '';
$user_today .= ' ('.$user_today_text['zuletzt_um'].' '.date('H:i', $row['user_session_time']).')<br />';
if ($a > $r)
{
$user_today .= ($count_user_today > 0) ? '</span></td></tr><tr><td class="row1" align="center"><span class="gen"> ' : '';
$a = 0;
}
else
{
$user_today .= ($count_user_today >= 0) ? '</span></td><td class="row1" align="center"><span class="gen"> ' : '';
}
$a = $a + 1;
$count_user_today++;
}
$user_today_text['count_user'] = ($count_user_today > 0) ? str_replace('{COUNT_USER_TODAY}', $count_user_today, $user_today_text['count_user']) : $user_today_text['no_user'];
$db->sql_freeresult($result);
$template->assign_vars(array(
'COUNT_USER_TODAY' => $user_today_text['count_user'],
'USER_TODAY' => $user_today,
'R' => $r,
));
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
templates/xxxxx/wer_war_hier.tpl:
Code: Alles auswählen
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> - {COUNT_USER_TODAY}</td>
</tr>
</table>
<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center">
<tr>
<th class="thHead"> </th>
<th class="thHead"> </th>
<th class="thHead"> </th>
<th class="thHead"> </th>
</tr>
<tr>
<td class="row1" align="center"><span class="gen">{USER_TODAY}</span></td>
</tr>
<tr>
<td class="catBottom" height="28"> </td>
<td class="catBottom" height="28"> </td>
<td class="catBottom" height="28"> </td>
<td class="catBottom" height="28"> </td>
</tr>
</table>
<br clear="all" />
Geht zwar auch einfacher, aber der Code funzt auch.