MyBB Community Forums

Full Version: Forum stats image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So far I have this
[Image: greenstats.php]

Here is the code

<?php
$connect = mysql_connect("127.0.0.1", "DB USER", "DB PASSWORD") or die();
$selectdb = mysql_select_db("DB NAME", $connect) or die();
$posts = mysql_num_rows(mysql_query("SELECT * FROM `mybb_posts`"));
$threads = mysql_num_rows(mysql_query("SELECT * FROM `mybb_threads`"));
$members = mysql_num_rows(mysql_query("SELECT * FROM `mybb_users`"));
header("Content-type: image/png");
$picture = imagecreate(360, 55);
$black = imagecolorallocate($picture, 0, 0, 0);
imagecolortransparent($picture, $black);
$green = imagecolorallocate($picture, 255, 0, 153);
imagestring($picture, 10, 5, 10, 'SEForums Has '.$posts.' Posts.', $green);
imagestring($picture, 10, 5, 25, 'SEForums Has '.$threads.' Threads.', $green);
imagestring($picture, 10, 5, 40, 'SEForums Has '.$members.' Members.', $green);
imagepng($picture);
imagedestroy($picture);
?>

I want to make it so that it also shows

Users online: 10 (Or whatever is online)

How do I do this?

Regards Ben
You will need to have access to the mybb settings, but:
$timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
$usersonline= mysql_result(mysql_query("SELECT COUNT(s.sid) AS c FROM mybb_sessions s WHERE s.time>'$timesearch'"), 0, 'c');
(2011-06-03, 11:31 PM)Aries-Belgium Wrote: [ -> ]You will need to have access to the mybb settings, but:
$timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
$usersonline= mysql_result(mysql_query("SELECT COUNT(s.sid) AS c FROM mybb_sessions s WHERE s.time>'$timesearch'"), 0, 'c');

Do you know the default value of wolcutoff

Or how would I give access to mybb settings/
Dont worry, I figured it out, It looks awesome

All I can say is THANKSSSSSSSSSSSSS