MyBB Community Forums

Full Version: How to add this ( in post ) to my webpage?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How i can add this to my webpage?
Members :
Guests :
Users online :
Newest member :

How i can put it to my webpage? I want its going to show, how many members my forum have, how many guests are on my forum, how many users are online, and the newest member.
does ur website use php ?

or it's html !

regards
Its html
my site supports php and i know novice phper id really like to know how to import the forum stats on my webpage
could anyone help me?
Use that php code and translate it to html. And add on index Wink
Here's the code to get some of the stats. I separated them into two parts: one if you use MyBB core, and other if you don't.

$query = mysql_query("SELECT COUNT(*) AS count FROM mybb_users");
$returned = mysql_fetch_array($query);
$total_members = $returned['count']; // Total number of users

$query = mysql_query("SELECT username FROM mybb_users ORDER BY regdate DESC LIMIT 1");
$returned = mysql_fetch_array($query);
$newest_member = $returned['username']; // Username of the newest member

$query = mysql_query("SELECT COUNT(*) AS count FROM mybb_threads WHERE visible='1'");
$returned = mysql_fetch_array($query);
$total_threads = $returned['count']; // Total number of threads

$query = mysql_query("SELECT COUNT(*) AS count FROM mybb_posts WHERE visible='1'");
$returned = mysql_fetch_array($query);
$total_posts = $returned['count']; // Total number of posts

$timesearch = time() - 15*60;
$query = mysql_query("SELECT COUNT(*) AS count FROM mybb_sessions s WHERE s.time>'$timesearch'");
$returned = mysql_fetch_array($query);
$total_online = $returned['count']; // Total number of users online

Using MyBB core it's easier to get some of the info:
require "./global.php"; // You need this somewhere on the page before the following code
$stats = $cache->read("stats");
$newest_member = $stats['lastusername']; // This is the username of the newest member
$total_posts = $stats['numposts']; // This is the total number of posts
$total_threads = $stats['numthreads'] // This is the total number of threads
$total_users = $stats['numusers']; // This is the total number of users

$timesearch = time() - $mybb->settings['wolcutoffmins']*60;
$query = $db->query("SELECT COUNT(*) AS count FROM ".TABLE_PREFIX."sessions s WHERE s.time>'$timesearch'");
$count = $db->fetch_array($count);
$total_online = $count['count']; // Number of users online (default within 15 minutes)

After, you can put an 'echo' to output it onto the page. For example:

The total number of users online on my forum is: <?php echo $total_online;?>
thanks alot...i love u!