außerdem hätte ich gern teile des footers auf meiner website, sprich die "who's online" anzeige. habe mir eine online.php erstellt und per include in die site integriert, bekomme aber folgende fehlermeldungen:
Code: Alles auswählen
Warning: main(./extension.inc): failed to open stream: No such file or directory in /srv/www/htdocs/web16/html/aaa/board/online.php on line 28
Warning: main(): Failed opening './extension.inc' for inclusion (include_path='.:/usr/share/php') in /srv/www/htdocs/web16/html/aaa/board/online.php on line 28
Warning: main(./common.): failed to open stream: No such file or directory in /srv/www/htdocs/web16/html/aaa/board/online.php on line 29
Warning: main(): Failed opening './common.' for inclusion (include_path='.:/usr/share/php') in /srv/www/htdocs/web16/html/aaa/board/online.php on line 29
Fatal error: Call to undefined function: session_pagestart() in /srv/www/htdocs/web16/html/aaa/board/online.php on line 34
Code: Alles auswählen
<?php
/***************************************************************************
## Mod Title: Who's online on any other page
## Filename: online.php
## Mod Version: 1.0.7
## Author: Acid <acid_junky@web.de> , Germany, Berlin
## Modified by : easygo <webmaster@net4seven.de> , Germany
## Description: Shows on index page who is online on forum now
##
## Installation Level: easy
## Installation Time: 1 Minute
########################################################
##
## Pre-Installation Notes:
## This only works with MySQL.
##
## Installation Notes:
## <?php include('online.php'); ?> must be the first line at the
## index page (to avoid warnings "Cannot add header information...")
##
## put <?php echo $onlinet; ?> - to show online users on forum -
## wherever you want @ your index page
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = "./"; //path to below files
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//
// End session management
//
$logged_visible_online = 0;
$logged_hidden_online = 0;
$guests_online = 0;
$online_userlist = '';
$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = " . intval($forum_id) : '';
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 ) . "
$user_forum_sql
ORDER BY u.username ASC, s.session_ip ASC";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain user/online information.", "", __LINE__, __FILE__, $sql);
}
$userlist_ary = array();
$userlist_visible = array();
$prev_user_id = 0;
while( $row = $db->sql_fetchrow($result) )
{
// User is logged in and therefor not a guest
if( $row['session_logged_in'] )
{
// Skip multiple sessions for one user
if( $row['user_id'] != $prev_user_id )
{
$style_color = '';
if( $row['user_level'] == ADMIN )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
}
else if( $row['user_level'] == MOD )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
}
if( $row['user_allow_viewonline'] )
{
$user_online_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
$logged_visible_online++;
}
else
{
$user_online_link = '<a href="' . append_sid($phpbb_root_path."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
$logged_hidden_online++;
}
if( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
{
$online_userlist .= ( $online_userlist != "" ) ? ", " . $user_online_link : $user_online_link;
}
}
}
else
{
// Skip multiple sessions for one user
if ( $row['session_ip'] != $prev_session_ip )
{
$guests_online++;
}
}
$prev_session_ip = $row['session_ip'];
//$prev_user_id = $row['user_id'];
}
if ( empty($online_userlist) )
{
$online_userlist = $lang['None'];
}
$online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . " " . $online_userlist;
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
if ( $total_online_users > $board_config['record_online_users'] )
{
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$total_online_users'
WHERE config_name = 'record_online_users'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update online user record (nr of users)", "", __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '" . time() . "'
WHERE config_name = 'record_online_date'";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update online user record (date)", "", __LINE__, __FILE__, $sql);
}
$board_config['record_online_users'] = $total_online_users;
$board_config['record_online_date'] = time();
}
$l_t_user_s = ( $total_online_users == 0 ) ? $lang['Online_users_zero_total'] : (( $total_online_users == 1 ) ? $lang['Online_user_total'] : $lang['Online_users_total']);
$l_r_user_s = ( $logged_visible_online == 0 ) ? $lang['Reg_users_zero_total'] : (( $logged_visible_online == 1 ) ? $lang['Reg_user_total'] : $lang['Reg_users_total']);
$l_h_user_s = ( $logged_hidden_online == 0 ) ? $lang['Hidden_users_zero_total'] : (( $logged_hidden_online == 1 ) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total']);
$l_g_user_s = ( $guests_online == 0 ) ? $lang['Guest_users_zero_total'] : (( $guests_online == 1 ) ? $lang['Guest_user_total'] : $lang['Guest_users_total']);
$l_online_users = sprintf($l_t_user_s, $total_online_users);
$l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
$l_online_users .= sprintf($l_g_user_s, $guests_online);
$onlinet="$l_online_users<br />$online_userlist<br />";
?>