SSI.php question: Online member count

Started by MoreBloodWine, September 14, 2013, 10:25:52 AM

Previous topic - Next topic

MoreBloodWine

$online_members = number_format($context['num_users_online']);

Thats a line from the stat sig code used to produce the image in my signature. Well, I was curious how it would be changed to show either online guest / online users "actual members".

I wana add an extra line to my sig for guests to seperate them from actual online users if possible.

Ty.

Edit: Here's the entire code set form the php file.

<?php

if (file_exists(dirname(__FILE__) . '/../SSI.php')) {
  require(
dirname(__FILE__) . '/../SSI.php');
}
else
die();

signature();

function
signature(){

$data = file_get_contents(dirname(__FILE__) . '/../index.php');
if (
preg_match('/$forum_version = [\'"]SMF\s*([^\']*)[\'"]/is', $data, $m)
 ||
preg_match('/@version\s*([0-9\.]*(?:\s?RC[0-9]*)?)/is', $data, $m)
 
//  || preg_match('/Software Version:\s*SMF\s*([0-9\.]*(?:\s?RC[0-9]*)?)/is', $data, $m)
) {  
 
// $m[1] now holds the version number  
} else {  
 
// parse error  
}

global
$smcFunc, $context, $settings, $modSettings, $boardurl;

 
$request = $smcFunc['db_query']('', '
     SELECT count(session)        
     FROM {db_prefix}log_online
     '
,
     array()
  );
 
list (
$context['num_users_online']) = $smcFunc['db_fetch_row']($request);  
$smcFunc['db_free_result']($request);

$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$timel = date("F jS Y g:ia T", $now);
$total_members = number_format($context['common_stats']['total_members']);
$online_members = number_format($context['num_users_online']);
$total_topics = number_format($context['common_stats']['total_topics']);
$total_posts = number_format($context['common_stats']['total_posts']);
$last_member = $context['common_stats']['latest_member']['name'];
$forum_version = $m[1];

$base = isset($_GET['base']) ? trim(htmlspecialchars($_GET['base'])) : '';

switch (
$base) {
   case
'alt1':
       
$image ='http://www.dust514corps.com/forum_stat_sigs/signature_info_alt1.png';
       break;
   case
'alt2':
       
$image = 'http://www.dust514corps.com/forum_stat_sigs/signature_info_alt2.png';
       break;
   default:
     
$image = 'http://www.dust514corps.com/forum_stat_sigs/signature_info.png';
}

$im = imagecreatefrompng($image);
if (!
$im)
{
 
$im = imagecreatetruecolor(385, 110); // x-coordinate,  y-coordinate
  //default is black but if you want another background color uncheck
  //imagefill($im, 0, 0, 255, 0, 0); // red etc
}

$green = ImageColorAllocate ($im, 23, 124, 17);
$lightblue = ImageColorAllocate ($im, 0, 204, 153);
$lightgreen = ImageColorAllocate ($im, 153, 255, 51);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);

ImageString($im, 3, 4, 1, "Statistics of $forum_name", $lightblue);
ImageString($im, 3, 102, 15, "$forum_url", $lightblue);
ImageString($im, 3, 102, 31, "Time: $timel", $lightgreen);
ImageString($im, 3, 102, 46, "Total Members: $total_members", $white);
ImageString($im, 3, 102, 61, "Online Members: $online_members", $white);
ImageString($im, 3, 262, 46, "Total Topics: $total_topics", $white);
ImageString($im, 3, 262, 61, "Total Posts: $total_posts", $white);
ImageString($im, 3, 102, 76, "Latest Member: $last_member", $lightgreen);
ImageString($im, 3, 120, 91, "Forum Version: $forum_version", $red);

$php = PHP_VERSION;
header("Content-Type: image/png");
if (@
version_compare(PHP_VERSION, '5.1.0', ">="))
 {
 
// if PHP v5.1 ++
 
Imagepng($im,null,9,null);  
 }
else {
   
Imagepng($im,null,9,null);
 }    
ImageDestroy ($im);
}
?>
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


MoreBloodWine

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: