It better to get the data from the bb config table (but it doesn'y have the total views
Code: Select all
<?php
define('CPG_NUKE', true);
include ('config.php');
include ('includes/db/mysql.php');
$db = new sql_db();
$db->sql_connect($dbhost, $dbuname, $dbpass, $dbname, $dbport, false);
$numviews = $numreplies = $numtopics = 0;
$result = $db->sql_query('SELECT topic_views, topic_replies FROM '.$prefix.'_bb2topics');
while( $post3 = $db->sql_fetchrow($result) ) {
$numviews = $numviews + $post3['topic_views'];
$numreplies = $numreplies + $post3['topic_replies'];
$numtopics++;
}
$db->sql_freeresult($result);
$numposts = $numtopics + $numreplies;
$image = 'images/signature2.png';
$im = imagecreatefrompng($image);
$tc = ImageColorAllocate ($im, 0, 0, 0);
$tc2 = ImageColorAllocate ($im, 0, 0, 255);
ImageString($im, 3, 155, 5, 'Here's the Live statistics', $tc);
ImageString($im, 2, 190, 20, 'Total Topics :', $tc);
ImageString($im, 2, 280, 20, $numtopics, $tc2);
ImageString($im, 2, 190, 30, 'Total Posts :', $tc);
ImageString($im, 2, 280, 30, $numposts, $tc2);
ImageString($im, 2, 190, 40, 'Total Views :', $tc);
ImageString($im, 2, 280, 40, $numviews, $tc2);
header('Content-Type: image/png');
Imagepng($im,'',100);
ImageDestroy ($im);
?>