News:

Wondering if this will always be free?  See why free is better.

Main Menu

signature info stats [no more updates and support]

Started by sebastian, August 20, 2005, 10:42:12 PM

Previous topic - Next topic

sebastian

Yes dumbelljunkie, have you try this -> Imagepng($im,'',0) ?

brianjw

#61
I need help. How would I add Latest member to right under the Online Members. Can you edit the following code to make it work like that. :)

Thanks.
Brianjw


<?php

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

signature();

function 
signature()
{
global 
$context$settings$modSettings$db_prefix$boardurl;

$result db_query("
SELECT COUNT(session)
FROM 
{$db_prefix}log_online"__FILE____LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
mysql_free_result($result);

$forum_ver 'SMF ' $modSettings['smfVersion'];
$img_url $settings['default_theme_url']; 
$forum_name $context['forum_name'];
$forum_url $boardurl;
$timezone $modSettings['time_offset'];
$now forum_time();
$time gmdate("d-M-Y H:i:s",$now 3600*($timezone+date("I")));
$timel date("d-M-Y H:i:s",$now);
$total_members $context['common_stats']['total_members'];
$total_posts $context['common_stats']['total_posts'];
$total_topics $context['common_stats']['total_topics'];
$online_members $context ['users_online'];
 

$image "$img_url/images/signature_info.png"// or where you want
$im imagecreatefrompng($image); 
$green ImageColorAllocate ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);

 
ImageString($im3901"$forum_url"$blue);
ImageString($im39015"$time Greenwich Time"$green); 
ImageString($im39031"$timel Local Time"$green);
ImageString($im39046"Total Members : $total_members"$red);
ImageString($im39061"Online Members: $online_members"$red);
ImageString($im323046"Total Posts: $total_posts"$red);
ImageString($im323061"Total Topics: $total_topics"$red);
ImageString($im39076"Forum Version: $forum_ver "$black);
 
header("Content-Type: image/png"); 
Imagepng($im,'',90);
// if PHP v5.1 ++
// Imagepng($im,'',9);  
ImageDestroy ($im); 
}
?>


EDIT: Also it says my smf version is 1.1.2 instead of 1.1.3 and what is Greenwich time?
EDIT2: Changed code.

sebastian

#62
Hello brianjw

Just add, modify & delete some lines...

$last_member = $context['common_stats']['latest_member']['name'];
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);


REPLACE
//$forum_ver = 'SMF ' . $modSettings['smfVersion'];
WITH
$forum_ver = 'SMF 1.1.3'; //manual changes

REPLACE
ImageString($im, 3, 90, 76, "Forum Version: $forum_ver ", $black);
WITH
ImageString($im, 3, 90, 91, "Forum Version: $forum_ver ", $black);

DELETE
$timezone = $modSettings['time_offset'];
$time = gmdate("d-M-Y H:i:s",$now - 3600*($timezone+date("I")));
ImageString($im, 3, 90, 15, "$time Greenwich Time", $green);


Finally

<?php

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

signature();

function 
signature()
{
global 
$context$settings$modSettings$db_prefix$boardurl;

$result db_query("
SELECT COUNT(session)
FROM 
{$db_prefix}log_online"__FILE____LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
mysql_free_result($result);

//$forum_ver = 'SMF ' . $modSettings['smfVersion'];
$forum_ver 'SMF 1.1.3'//manual changes
$img_url $settings['default_theme_url']; 
$forum_name $context['forum_name'];
$forum_url $boardurl;
$now forum_time();
$timel date("d-M-Y H:i:s",$now);
$total_members $context['common_stats']['total_members'];
$total_posts $context['common_stats']['total_posts'];
$total_topics $context['common_stats']['total_topics'];
$online_members $context ['users_online'];
$last_member $context['common_stats']['latest_member']['name']; 

$image "$img_url/images/signature_info.png"// or where you want
$im imagecreatefrompng($image); 
$green ImageColorAllocate ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);

 
ImageString($im3901"$forum_url"$blue);
ImageString($im39031"$timel Local Time"$green);
ImageString($im39046"Total Members : $total_members"$red);
ImageString($im39061"Online Members: $online_members"$red);
ImageString($im323046"Total Posts: $total_posts"$red);
ImageString($im323061"Total Topics: $total_topics"$red);
ImageString($im39076"Latest Member: $last_member "$red);
ImageString($im39091"Forum Version: $forum_ver "$black);
 
header("Content-Type: image/png"); 
Imagepng($im,'',90);
// if PHP v5.1 ++
//Imagepng($im,'',9);  
ImageDestroy ($im); 
}
?>

brianjw

#63
Thanks. As you can see:

All is working well.

However, I did not make the manual edit for the version problem because I am thinking there has to be some other way. Somehow some file didn't get updated and I want to fix the file so it works and updates without a manual edit each time I upgrade. Any ideas where to go? SSI.php maybe? Wherever the code $modSettings['smfVersion'] is being called would be the place to go I think. :)

Brianjw

EDIT: Another few questions.
  • Can I make the local timezones time appear as am/pm time instead of military time?
  • What was the point of Greenwich time to be in the code, what was it's purpous?

sebastian

I agree with you that 'SMF Version' is a weakness. However the definition of SMF Version becomes manually (index.php => $forum_version = 'SMF 1.1.3') and is being called as global variable.
This script is based on SSI.php which does not load this variable ($forum_version).

QuoteCan I make the local timezones time appear as am/pm time instead of military time?
$timel = date("d-M-Y g:i:s a",$now);

QuoteWhat was the point of Greenwich time to be in the code, what was it's purpous?
Not necessary. Delete this line.

L.G.S

Great mod, but a couple of questions:




What code do I use to replace blue with yellow?
How can I make it so that there is a space in between Total members and Total topics?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


brianjw

#66
@sebastian: Thanks for all your help. I tried to replace that timezone space so I tried adding Total Boards. I used the following codes:
$total_boards = $context['common_stats']['total_boards'];
ImageString($im, 3, 90, 61, "Total Boards: $total_boards", $red);
However it doesn't appear. Any ideas? (see signature)


@L.G.S: To replace the color blue with yellow you have to edit the following codes in the main file.
Find:

ImageString($im, 3, 10, 1, "$forum_name", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);

Replace:

ImageString($im, 3, 10, 1, "$forum_name", $yellow);
ImageString($im, 3, 94, 15, "$forum_url", $yellow);

Depending on the size of the space you have by the image width you descide. But for starters try some stuff below:
Find:
220
Replace with:
230
(make it a larger number for bigger space/make it smaller number for less space)
You may also try moving it over a little for more space...
Find: (note: you will have to manually find some of them as you can't find all this at once)

ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$timel Local Time", $green);
ImageString($im, 3, 90, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);

Replace with:

ImageString($im, 3, 89, 15, "$forum_url", $blue);
ImageString($im, 3, 85, 31, "$timel Local Time", $green);
ImageString($im, 3, 85, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 85, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 85, 76, "Latest Member: $last_member ", $red);


Hope this helps :)

Brianjw

L.G.S

Thanks, all worked except the colour change.

I presume I need to add a new line which would have an altered version of this, but I don't know the code:

$white = ImageColorAllocate ($im, 255, 255, 255);

Probably just need to edit the numbers but not sure to what.
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


sebastian

L.G.S
Yellow Color
$yellow = ImageColorAllocate ($im, 255, 204, 51);


brianjw
Total Boards

$result = db_query("
SELECT COUNT(*)
FROM {$db_prefix}boards AS b", __FILE__, __LINE__);
list ($context['num_boards']) = mysql_fetch_row($result);
mysql_free_result($result);


$total_boards = $context['num_boards'];

brianjw

Thanks it works. Also I was able to add a categories code by doing this:

$result = db_query("
SELECT COUNT(*)
FROM {$db_prefix}categories AS b", __FILE__, __LINE__);
list ($context['num_categories']) = mysql_fetch_row($result);
mysql_free_result($result);


$total_cats = $context['num_categories'];

;) Brianjw

sebastian


L.G.S

I got some problems...

I've tried changing all the placement code but I can't seem to get what I want.

See this here:


I'd like all the text under my link to be moved over to the left more so all the stats show, and then moved down a little so they aren't covering the circle graphic as much.

Can that be done?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


sebastian

Just play with x-coordinate, y-coordinate.


example
ImageString($im, 3, 10, 1, "$forum_name", $blue);
ImageString($im, 3, 94, 31, "$forum_url", $blue);
ImageString($im, 3, 30, 46, "$timel Local Time", $green);
ImageString($im, 3, 30, 61, "Total Members : $total_members", $red);
ImageString($im, 3, 30, 76, "Online Members: $online_members", $red);
ImageString($im, 3, 160, 76, "Total Posts: $total_posts", $red);
ImageString($im, 3, 160, 61, "Total Topics: $total_topics", $red);
ImageString($im, 3, 30, 91, "Latest Member: $last_member ", $red);

L.G.S

which ones are he x and y?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


sebastian

Quotewhich ones are he x and y?

ImageString($im, 3, 30, 91, "Latest Member: $last_member ", $red);

30 = x
91 = y

brianjw

I just started getting internal server error on
http://www.brianjwilson.com/signature_info.php

so it shows up broken. I recently installed Flashchat integration if that might do anything. Flashchat integration modifies SSI.php so...

Any ideas?

sebastian

#76
Quote from: brianjw on August 09, 2007, 01:07:54 PM
I recently installed Flashchat integration if that might do anything. Flashchat integration modifies SSI.php so...

I don't think so ... Its a server problem 500. Check your error_log file for errors about signature_info.php.

brianjw

I use godaddy and am not sure where to see the error log?

sebastian

Via ftp client  check your SMF FORUM folder.

File error_log.

brianjw

Quote from: sebastian on August 09, 2007, 07:44:01 PM
Via ftp client  check your SMF FORUM folder.

File error_log.
I don't seem to have that file.

Advertisement: