News:

Want to get involved in developing SMF, then why not lend a hand on our github!

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

So ...

New vision (Oct 12,  2007) - One man show signature







Get the code here

Arcade last 4 games + scores + position only
arcade last games thumbnails or scores + position
SMF  Shop -> money


access as
[img]http://www.mydomain.com/sign.php?u=x[/img]

http://www.mydomain.com/sign.php?u=x

u=x -> user ID

or
[img]http://www.mydomain.com/sign.png?u=x[/img]

http://www.mydomain.com/sign.png?u=x

u=x -> user ID

by adding  2 lines into your .htaccess file.

RewriteEngine On
RewriteRule sign.png sign.php


If the file sign.php is inside the folder /forum then .htaccess must be...

RewriteEngine On
RewriteRule sign.png /forum/sign.php


Clasic signature info stats-----------------------


-----------------------------------
First case no use font (left image)

STEP 1
make a file, for example signature_info.php and copy this file into root path of SMF installation. {full code below}

STEP 2
copy an image for background, for example this image (right click/save as image) --> into /Themes/Default/images    path

STEP 3
Goto your profile settings and set this text into your signature area ->
[img]http://my.forum.url.com/signature_info.php[/img]
for example -> [img]http://www.iamsmfuser.com/signature_info.php[/img]



Finally set your signature -->[img]http://mydomain/signinfo.png[/img][/center]


signature_info.php NO_FONTS (SMF 1.1.x)

<?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);

$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); 

if (!
$im)
 {
   
$im imagecreatetruecolor(385110); // 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 ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);
 
ImageString($im3101"$forum_name"$blue); 
ImageString($im39415"$forum_url"$blue);
ImageString($im39031"$timel Local Time"$green);
ImageString($im39046"Total Members : $total_members"$red);
ImageString($im39061"Online Members: $online_members"$red);
ImageString($im322061"Total Posts: $total_posts"$red);
ImageString($im322046"Total Topics: $total_topics"$red);
ImageString($im39076"Latest Member: $last_member "$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,90,null);
  }    
ImageDestroy ($im); 
}
?>


signature_info.php NO_FONTS (SMF 2.x.x)

<?php

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

signature();

function 
signature()
{
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);

$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['num_users_online'];
$last_member $context['common_stats']['latest_member']['name'];

$image "$img_url/images/signature_info.png"// or where you want
$im imagecreatefrompng($image); 

if (!
$im)
 {
   
$im imagecreatetruecolor(385110); // 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 ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);
 
ImageString($im3101"$forum_name"$blue); 
ImageString($im39415"$forum_url"$blue);
ImageString($im39031"$timel Local Time"$green);
ImageString($im39046"Total Members : $total_members"$red);
ImageString($im39061"Online Members: $online_members"$red);
ImageString($im322061"Total Posts: $total_posts"$red);
ImageString($im322046"Total Topics: $total_topics"$red);
ImageString($im39076"Latest Member: $last_member "$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); 
}
?>

----------------------------------------------------------------------------------------------------------------------------------

Second  case use font (right image)

STEP 1 STEP 2 STEP 3 is the same with first case

STEP 4
Make a folder /fonts in the same path of /Themes or where you want but change this from signature_info.php below
copy into folder /fonts a font file (ttf), for example arial.ttf or MTCORSVA.TTF (Monotype Corsiva) or other font but change the name and path from signature_info.php file below.



signature_info.php use font (SMF 1.1.x)

<?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$boarddir;

$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);

$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); 

if (!
$im)
 {
   
$im imagecreatetruecolor(385110); // 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 ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);
$font $boarddir .'/fonts/arial.ttf'// change your font path and name here
 
imagettftext($im1201015$blue$font"$forum_name"); 
imagettftext($im1209431$blue$font"$forum_url");
imagettftext($im1209046$green$font"$timel Local Time");
imagettftext($im1209061$red$font"Total Members : $total_members");
imagettftext($im1209076$red$font"Online Members: $online_members");
imagettftext($im12022076$red$font"Total Posts: $total_posts");
imagettftext($im12022061$red$font"Total Topics: $total_topics");
imagettftext($im1209091$red$font"Latest Member: $last_member ");
 
$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); 
}
?>


signature_info.php use font (SMF 2.x.x)

<?php

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

signature();

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

$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);

$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); 

if (!
$im)
 {
   
$im imagecreatetruecolor(385110); // 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 ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);
$font $boarddir .'/fonts/arial.ttf'// change your font path and name here
 
imagettftext($im1201015$blue$font"$forum_name"); 
imagettftext($im1209431$blue$font"$forum_url");
imagettftext($im1209046$green$font"$timel Local Time");
imagettftext($im1209061$red$font"Total Members : $total_members");
imagettftext($im1209076$red$font"Online Members: $online_members");
imagettftext($im12022076$red$font"Total Posts: $total_posts");
imagettftext($im12022061$red$font"Total Topics: $total_topics");
imagettftext($im1209091$red$font"Latest Member: $last_member ");
 
$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); 
}
?>

Snickers

I did a few changes so it fits mine better:

Code ("signature_info.php") Select
<?php

require(dirname(__FILE__) . '/SSI.php');

$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_version 'SMF 1.1 Beta 3 Public'//make manually changes
$forum_name $context['forum_name'];
$forum_url $boardurl;
$now forum_time();
$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'];
$latest_member $context['common_stats']['latest_member'];
 

$image "http://www.******.com/Themes/default/images/800%20by%20180.jpg"// or where you want
$im imagecreatefrompng($image); 
$green ImageColorAllocate ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);

 
ImageString($im3101"Statistics of $forum_name"$blue); 
ImageString($im39415"$forum_url"$blue);
ImageString($im39031"latest_member"$green); 
ImageString($im39061"Total Members : $total_members"$red);
ImageString($im39076"Online Members: $online_members"$red);
ImageString($im322061"Total Posts: $total_posts"$red);
ImageString($im322076"Total Topics: $total_topics"$red);
ImageString($im39091"Forum Version: $forum_version "$black);
 
header("Content-Type: image/png"); 
Imagepng($im,'',100); 
ImageDestroy ($im); 

?>


Please help me!

and I havn't edited the SSI.php....

Valodim

help you with what? I don't see no question or error message in your post... ::)

Snickers

Oh sorry, well when I go to reply mode and write:



and press preview, it doesn't show any image :(

Also if I go to: http://www.*****.com/signature_info.php

it says: The image "http://www.*****.com/signature_info.php" cannot be displayed, because it contains errors.

sebastian

#4
What errors Snickers?

Quote
$image = "http://www.******.com/Themes/default/images/800%20by%20180.jpg"; // or where you want
<---- Yours modification

MUST BE PNG FILE TO WORK PROPERLY because you call this file by header("Content-Type: image/png");


Owdy

Nice tip, thanks for sharing.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

eohjay

Hi, I've got a quick question for this...

I went through and edited everything and it seems to be working all right, but my Total Members, Total Posts, Total Topics, and Latest Member sections show up blank. The Online Members section works fine though, oddly.

Here's a example...



I have a feeling I'm missing something fairly obvious, can I get any help please?

Sting

mine won't show the latest member, but I haven't added any of this... strange.

CKnetworX

Quote from: eohjay on November 05, 2005, 05:06:36 AM
Hi, I've got a quick question for this...

I went through and edited everything and it seems to be working all right, but my Total Members, Total Posts, Total Topics, and Latest Member sections show up blank. The Online Members section works fine though, oddly.

Here's a example...



I have a feeling I'm missing something fairly obvious, can I get any help please?

Same here...
FREE Domains [nofollow] FREE Webhosting [nofollow]



sebastian

#9
eohjay or CKnetworX can you post your php code of "signature_info.php"? This tip is very easy to work properly.

ps Tested only with SMF 1.1 beta 3 and SMF 1.1 RC1

Now Snickers and Sting this is wrong --> ImageString($im, 3, 90, 31, "latest_member", $green);
Replace with this -> ImageString($im, 3, 90, 31, "latest_member : $latest_member", $green);

spottedhog

I have this signature_info.php working on my own forums, however, when I try to use it as a signature in another forum website, it does not work.  These other websites are phpbb websites.

any ideas?

thanks....


sebastian

#12
spottedhog  i haven't tried it in any phpbb forum, normally it can work anywhere.

Well, doesn's work.  I suppose it will work only with a mod to deactivate some default features of phpbb2.
Try this --->
open your .htaccess ADD this line AddType application/x-httpd-php .png

then rename your .php file to .png file... For example signinfo.php to signinfo.png...

Finally set your signature  [img]http://mydomain/signinfo.png[/img]


ArkServer i thing there's something wrong with your ssi.php and signature_info.php file.

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

If you have PHP v5.1++ try this Imagepng($im,'',9) instead Imagepng($im,'',90)

PrizeLive.com

is this available for version 1.1 rc2?
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

sebastian

Yes, is very simple script.

PrizeLive.com

Quote from: sebastian on July 09, 2006, 07:39:43 AM
Yes, is very simple script.

do i just use the code in the first post?
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

sebastian


IncubuS

Indeed very lovely , thanks for sharing .
www.the-ien.com [nofollow]

PrizeLive.com

#18
I tried this but no stats are showing...

This is all that shows -->



I'm using version 1.1 RC2.

Can someone help?
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

Chucky

#19
How do I make the entire image a hyperlink? Oh, and I almost forgot to say without using actual linking tags. I want the linking code to be in the php signature info file... possible?

Advertisement: