391
Mods & Plugins (Releases & Support) / Re: [Mod] Random image / Zufallsbild
« on: January 09, 2003, 01:27:01 PM »
This mod works fine for me, as well as phpBB Fetch Info does, but only one of these mods on the same page, alone. When I'm trying to run both mods together, on the same page, the phpBB Fetch Info doesn't work at all. I'm using different database for 4images and pbpBB.
Please advise, what could be the reason for this conflict? Thanks in advance!
Please advise, what could be the reason for this conflict? Thanks in advance!
Code: [Select]
<?php
#################################################################
## Mod Title: phpBB Fetch Info
## Author: Ca5ey <ca5ey@clanunity.net> Volker Rattel
#################################################################
#-----[ EXAMPLE USAGE ]------------------------------------------
## <?php
## define('IN_PHPBB', true);
## include('phpbb_fetch_info.php');
## $info = phpbb_fetch_info();
## ?>
## Total Posts: <?php echo $info['f_total_posts']; ?><br>
## Total Users: <?php echo $info['f_total_users']; ?><br>
## Newest User: <?php echo $info['newest_username']; ?><br>
## Newest User ID: <?php echo $info['newest_userid']; ?><br>
## User Online: <?php echo $info['f_user_online']; ?><br>
#################################################################
$phpbb_root_path = './phpBB2/';
$CFG['close_db'] = 1;
if (!file_exists($phpbb_root_path . 'extension.inc')) {
die('<b>phpBB Fetch Info:</b> The $phpbb_root_path setting is wrong and DOES NOT point to your forum.');
}
include_once ($phpbb_root_path . 'extension.inc');
include_once ($phpbb_root_path . 'common.'.$phpEx);
function phpbb_fetch_info()
{
global $db;
$info = array();
$info['f_total_posts'] = get_db_stat('postcount');
$info['f_total_users'] = get_db_stat('usercount');
$newest_user = get_db_stat('newestuser');
$info['newest_userid'] = $newest_user[0];
$info['newest_username'] = $newest_user[1];
$sql = 'SELECT
COUNT(session_id)
FROM
' . SESSIONS_TABLE . '
WHERE
session_time >= ' . ( time() - 300 );
if( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
}
$f_user_online = $db->sql_fetchrow($result);
$info['f_user_online'] = $f_user_online[0];
if ($CFG['close_db']) {
$db->sql_close();
}
return $info;
} // phpbb_fetch_info
?>