В течении 24-ех часов, наш форум посещали ...
Незнаю, может кому и пригодиться ...
Собственно, вырезка из мода:
## MOD Author: rhs98 <
russ@isitaboat.co.uk > (Russell Smith)
http://russ.isitaboat.co.uk/
## MOD Description: Shows which users have been online today.
## MOD Version: 1.1.2
Отличие от мода - список посетивших, выводится не на главную страницу, а в отдельную.
При посещаемом форуме, оригинальный мод будет сильно подгружать главную страницу, поэтому, передал.
Создаете два файла, и в index_body.tpl делаете ссылку на today.php.
today.php (в корень форума)
- Код: Выделить всё
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = "php";
include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management
// Lets build a page ...
$page_title = $l_title;
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'today.tpl')
);
make_jumpbox('viewforum.'.$phpEx);
// Begin USERS ONLINE TODAY
// http://russ.isitaboat.co.uk/
$uot_this_timestamp_array = getdate();
$uot_when_from = mktime ( 0 , 0 , 0 , $uot_this_timestamp_array[mon] , $uot_this_timestamp_array[mday] , $uot_this_timestamp_array[year] );
$sql = "SELECT count(*) cnt
FROM ".USERS_TABLE." u
WHERE u.user_session_time >= ". $uot_when_from . "
ORDER BY u.username ASC";
if ( !($uot_result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($uot_result);
$uot_count = $row['cnt'];
$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, user_session_time
FROM ".USERS_TABLE." u
WHERE u.user_session_time >= ". $uot_when_from . "
ORDER BY u.username ASC";
if ( !($uot_result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}
$users_online_today=array();
while ( $row = $db->sql_fetchrow($uot_result) )
{
//counter stuff
$$which_counter++;
$row_color = ( $$which_counter % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( $$which_counter % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
//generate the user name (robbed from the code above)
$uot_user_id = $row['user_id'];
//reset the style...
$uot_style = '';
if ( $uot_user_id != $prev_user )
{
$uot_username_plain = $uot_username = $row['username'];
if ( $row['user_level'] == ADMIN )
{
$uot_style = 'style="color:#' . $theme['fontcolor3'] . ';"';
$uot_username = '<b>' . $uot_username . '</b>';
}
else if ( $row['user_level'] == MOD )
{
$uot_style = 'style="color:#' . $theme['fontcolor2'] . ';"';
$uot_username = '<b>' . $uot_username . '</b>';
}
if ( !$row['user_allow_viewonline'] )
{
$view_online = ( $userdata['user_level'] == ADMIN ) ? true : false;
$uot_username = $lang['UOT_hidden_start'] . $uot_username . $lang['UOT_hidden_end'];
}
else
{
$view_online = true;
}
}
//annon does not have a profile...
if($row['user_id']>0){
$uot_username = sprintf('<a href="profile.php?mode=viewprofile&u=%d" title="%s последнее посещение в: %s" %s>%s</a>',$uot_user_id,$uot_username_plain,create_date('d-m-Y H:i', $row['user_session_time'], $board_config['board_timezone']),$uot_style,$uot_username);
}
//this will show just the user's name, with the time in the tool tip.
if($view_online)
{
array_push($users_online_today,$uot_username);
}
}
if(count($users_online_today)==0){
array_push($users_online_today,$lang['UOT_none']);
}
$template->assign_vars(array(
'UOT_COUNT' => $uot_count,
'UOT_LIST' => implode(", ",$users_online_today)
)
);
//end of UOT
// Generate the page
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
today.tpl в (templates/xxxxxxx/today.tpl)
- Код: Выделить всё
<br><table width=100% cellspacing=2 cellpadding=2 border=0><tr><td><a class=topictitle href="{U_INDEX}">{L_INDEX}</a></td></tr></table>
<table class=forumline width=100% cellspacing=1 cellpadding=3 border=0>
<tr><th>В течении 24-ех часов, наш форум посещало участников - <font color="bb1100">{UOT_COUNT}</font></th></tr>
<tr class=postbody>
<td class=row1 align=left> {UOT_LIST} </td>
</tr>
</table>
<br>
<table width=100% height=30 border=0 cellpadding=2 cellspacing=0 align=center>
<tr class=postbody><td align=left valign=top>{JUMPBOX}</td></tr>
</table>
Шаблон, естественно, подгоните под себя.
К сожалению, оформлять по правилам, нет времени, но на вопросы, по возможности, отвечу ...
Всегда есть решение ...