Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Forum stats on signature image Details »»
Forum stats on signature image
Version: 1.00, by tkeil69575 tkeil69575 is offline
Developer Last Online: Sep 2007 Show Printable Version Email this Page

Version: 2.3.x Rating:
Released: 03-25-2003 Last Update: Never Installs: 64
 
No support by the author.

[high]Remember the forum rules here at vB.org and don't exceed the signature dimensions: https://vborg.vbsupport.ru/showthrea...threadid=50062 . Signatures in violation of the rules will be suspended. --filburt1[/high]

Hi all,

What this hack does:
Calls up your Forum statistics (like No. of Members, Threads and Posts) and creates a new image on your server using GD which you can use as a signature image, where ever you like - have a look at my signature and you'll see what I mean. This is only my 2nd hack - so be kind to me

In order to have the image created, say every 15 minutes you will need to set up a cronjob. Infos are provided in the instructions.txt, and alternatives for those who do not have access to crontab on their server.

Support:
Because I'm pretty busy, I will provide only limited support. Will look in here once a week or so.

Credits:
to kars10 for kicking me in the ass and getting me to code this - thanks karsten

greets
tina

Update 23.06.2003
- global.php no longer required, thus when signature image is being created it no longer shows up in "who is onlne"
- quality of image output improved
- debug modus with email notification integrated
- tested with gd2

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #202  
Old 09-17-2003, 08:34 PM
insanctus's Avatar
insanctus insanctus is offline
 
Join Date: Feb 2003
Location: Michigan
Posts: 582
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$width = 258;//Width of banner image
$height = 65;//Height of banner image
$left = 5; //Left text-margin
$top = 40; //text-margin from top
$zeilenabstand = 15; //Line-spacing of text

Is mine, notice the top, ya need change it till is right . Myself I used psp to find the pixel location I wanted.
Reply With Quote
  #203  
Old 09-17-2003, 09:43 PM
Almax1 Almax1 is offline
 
Join Date: Sep 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$text "Members: $numbermembers Threads: $totalthreads Posts: $totalposts\n"
fixed it thanx for your help m8
Reply With Quote
  #204  
Old 09-17-2003, 09:49 PM
insanctus's Avatar
insanctus insanctus is offline
 
Join Date: Feb 2003
Location: Michigan
Posts: 582
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

n/p man , ack i forgot the \n at end sorry about that.
Reply With Quote
  #205  
Old 10-08-2003, 05:12 AM
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Location: Winnipeg
Posts: 318
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Brand new version installed... All I get is a white page. The JPEGs aren't updating either.
Reply With Quote
  #206  
Old 10-08-2003, 05:25 AM
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Location: Winnipeg
Posts: 318
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, whoops.

Don't save PHPs as Unicode.
Reply With Quote
  #207  
Old 10-13-2003, 07:10 PM
sweet22 sweet22 is offline
 
Join Date: Jul 2003
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i keep getting this error:
Quote:
Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/anima823/public_html/community/signature.php on line 83
Reply With Quote
  #208  
Old 10-14-2003, 06:06 AM
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Location: Winnipeg
Posts: 318
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sweet22
i keep getting this error:
That's called not having GD2 installed.
Reply With Quote
  #209  
Old 10-15-2003, 12:15 PM
M@rkus M@rkus is offline
 
Join Date: Jul 2003
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now.. i ve followed the discussion all along now.

But there is my problem right now.

Right now my Sig. looks like this:




and the code looks like this:

PHP Code:
<?php
error_reporting
(7);

//Version 2 - 25.06.2003

$host "******";        //DB-Servername
$user"*******";          //DB-Username
$password"******";      //DB-Password
$database="*******";       //vbulletin database name
$adminemail "webmaster@e34m.de";  //E-Mail Address where MySQL Error Messages are sent to

$width 470;//Width of banner image
$height 62;//Height of banner image
$left 153//Left text-margin
$top 8//text-margin from top
$zeilenabstand 15//Line-spacing of text
$vorlagedatei "./images/signatur/sig.jpg";  //full path to empty signature image (input image)
$ausgabedatei "./images/signatur/signatur2.jpg"//full path to signare image with forum data (output image)
$komprimierung 95//Compression of output image
$debug 0//debug mode

################ DO NOT EDIT BELOW #################

function mysql_query_eval($query$database) {
    
$mysql_eval_error="";
    
$mysql_eval_result mysql_query($query$database) or $mysql_eval_error mysql_error();
    if (
$mysql_eval_error) {
        if ( 
$debug == ) {
            
$letter "An error was encountered during execution of the query:\n\n";
            
$letter .= $query."\n\n";
            
$letter .="The query returned with an errorcode of: \n\n$mysql_eval_error\n\n";
            
$letter .="To turn this email off set debug=0 in signature.php\n\n";
            
$email_from "From: ".$adminemail;
            
$subject="Subject: Signature Error Report";
            
$subject=trim($subject);
            
mail$email$subject$letter$email_from );
        } elseif ( 
$debug == ) {
        
dieWell"MySQL error reported!<p>Query: $query<p>Result: $mysql_eval_error<p>Database handle: $database);
        exit;
        }
        return 
FALSE;
    } else {
     return 
$mysql_eval_result;
   }
}

// Connecting, selecting database
$link mysql_connect ("$host""$user""$password") or die ('I cannot connect to the database.');
mysql_select_db ("$database")or die("Could not select database"); 

// get forum members
$querya="SELECT COUNT(*) AS users, MAX(userid) AS max FROM user WHERE usergroupid!=4";
$numa mysql_query_eval($querya,$link);
$numb mysql_fetch_array($numa);
$numbermembers=number_format($numb['users']);
mysql_free_result($numa);        

// get total posts
$queryb="SELECT COUNT(*) AS posts FROM post";
$posta mysql_query_eval($queryb,$link);
$postb mysql_fetch_array($posta);
$totalposts=number_format($postb['posts']);
mysql_free_result($posta);

//get total threads
$queryc="SELECT COUNT(*) AS threads FROM thread";
$threada mysql_query_eval($queryc,$link);
$threadb mysql_fetch_array($threada);
$totalthreads=number_format($threadb['threads']);
mysql_free_result($threada);

$text "Members: $numbermembers\nThreads: $totalthreads\nPosts: $totalposts\n";

$worte split("\n"$text);
if(
is_array($worte)){
    
$i 0;
    foreach(
$worte as $wort){
    
$i++;
    
$output[$i] = $wort;
    }
}

$vorlage imagecreatefromjpeg("$vorlagedatei"); 
$img imagecreatetruecolor($width,$height);

//a png uses ImageColorAllocate instead of ImageColorClosest like jpeg uses
$bg_color imagecolorallocate ($img255255255); //background white
$text_color imagecolorallocate ($img000); //black text
imagefilledrectangle ($img00$width$height$bg_color);

imagecopy ($img$vorlage0000$width$height); // copy empty banner

imagecolortransparent($img$bg_color);  // set dummybg transparent
 
// the distance is in pixels and the font # is 1 through 5
$i 0;
while(
$i count($output)){
imagestring($img2$left, (($i $zeilenabstand) - $zeilenabstand $top), $output[$i], $text_color);
$i++;


header("Content-Type: image/png");
imagepng($img); 
imagejpeg($img"$ausgabedatei",$komprimierung); //Write jpg to folder and set compression 
imagedestroy($img); // get the image out of memory
?>

When i want to have the total post etc in my sig. i would change it to the following code:

PHP Code:
<?php
error_reporting
(7);

//Version 2 - 25.06.2003

$host "*******";        //DB-Servername
$user"*********";          //DB-Username
$password"*******";      //DB-Password
$database="*******";       //vbulletin database name
$adminemail "webmaster@e34m.de";  //E-Mail Address where MySQL Error Messages are sent to

$width 470;//Width of banner image
$height 62;//Height of banner image
$left 153//Left text-margin
$top 8//text-margin from top
$zeilenabstand 15//Line-spacing of text
$vorlagedatei "./images/signatur/sig.jpg";  //full path to empty signature image (input image)
$ausgabedatei "./images/signatur/signatur2.jpg"//full path to signare image with forum data (output image)
$komprimierung 95//Compression of output image
$debug 0//debug mode

################ DO NOT EDIT BELOW #################

function mysql_query_eval($query$database) {
    
$mysql_eval_error="";
    
$mysql_eval_result mysql_query($query$database) or $mysql_eval_error mysql_error();
    if (
$mysql_eval_error) {
        if ( 
$debug == ) {
            
$letter "An error was encountered during execution of the query:\n\n";
            
$letter .= $query."\n\n";
            
$letter .="The query returned with an errorcode of: \n\n$mysql_eval_error\n\n";
            
$letter .="To turn this email off set debug=0 in signature.php\n\n";
            
$email_from "From: ".$adminemail;
            
$subject="Subject: Signature Error Report";
            
$subject=trim($subject);
            
mail$email$subject$letter$email_from );
        } elseif ( 
$debug == ) {
        
dieWell"MySQL error reported!<p>Query: $query<p>Result: $mysql_eval_error<p>Database handle: $database);
        exit;
        }
        return 
FALSE;
    } else {
     return 
$mysql_eval_result;
   }
}

// Connecting, selecting database
$link mysql_connect ("$host""$user""$password") or die ('I cannot connect to the database.');
mysql_select_db ("$database")or die("Could not select database"); 

// get forum members
$querya="SELECT COUNT(*) AS users, MAX(userid) AS max FROM user WHERE usergroupid!=4";
$numa mysql_query_eval($querya,$link);
$numb mysql_fetch_array($numa);
$numbermembers=number_format($numb['users']);
mysql_free_result($numa);        

// get total posts
$queryb="SELECT COUNT(*) AS posts FROM post";
$posta mysql_query_eval($queryb,$link);
$postb mysql_fetch_array($posta);
$totalposts=number_format($postb['posts']);
mysql_free_result($posta);

//get total threads
$queryc="SELECT COUNT(*) AS threads FROM thread";
$threada mysql_query_eval($queryc,$link);
$threadb mysql_fetch_array($threada);
$totalthreads=number_format($threadb['threads']);
mysql_free_result($threada);

//get total online today
// today online hack begin
  
if ((int)$maxusers[0] <= $totalonline) {
    
$time time();
    
$maxloggedin "$totalonline " $time " " $maxusers[2] . " " $maxusers[3];
    
$DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
    
$maxusers[0] = $totalonline;
    
$maxusers[1] = $time;
  }

  
$todayloggedinusers "";
  
$numbertodayonline 0;
  
$numbertodayonlineinvisible 0;

  
$todayusers=$DB_site->query("SELECT userid, username, usergroupid, lastactivity, invisible FROM user
                WHERE lastactivity > " 
. (mktime(0,0,0,date("m"),date("d"),date("Y")) + (($bbuserinfo['timezoneoffset']-$timeoffset)*3600)) . "
                ORDER BY username"
);
  while (
$todayuser=$DB_site->fetch_array($todayusers)) {
    
$numbertodayonline++;
    
$invisibleuser '';
    
$userid $todayuser['userid'];
    
$lastactivetime vbdate($timeformat$todayuser[lastactivity]);
    if (
$todayuser['invisible']==and $bbuserinfo['usergroupid']!=6) {
      
$numbertodayonlineinvisible++;
      continue;
    }
    if (
$todayuser['invisible'] == 1) { // Invisible User but show to Admin
      
$invisibleuser '*';
    }
    if (
$todayuser['usergroupid'] == and $highlightadmin) {
      
$username "<b><i>$todayuser[username]</i></b>";
    } else if ((
$mod["$userid"] or $todayuser['usergroupid'] == 5) and $highlightadmin) {
      
$username "<b>$todayuser[username]</b>";
    } else {
      
$username $todayuser['username'];
    }
    if (!
$todayloggedinuser) {
      eval(
"\$todayloggedinuser = "".gettemplate('forumhome_todayloggedinuser')."";");
    } else {
      eval(
"\$todayloggedinuser .= ", ".gettemplate('forumhome_todayloggedinuser')."";");
    }
  }

  
$DB_site->free_result($todayusers);

  if (
$bbuserinfo[usergroupid] == 6) {
    
$todayonline $numbertodayonline;
  } else {
    
$todayonline $numbertodayonline $numbertodayonlineinvisible;
  }

  if ((int)
$maxusers[2] <= $numbertodayonline) {
    
$time time();
    
$maxloggedin $maxusers[0] . " " $maxusers[1] . $numbertodayonline " $time;
    
$DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'");
    
$maxusers[2] = $numbertodayonline;
    
$maxusers[3] = $time;
  }

  
$todayrecordusers $maxusers[2];
  
$todayrecorddate vbdate($dateformat,$maxusers[3]);

$text "Members: $numbermembers\nThreads: $totalthreads\nPosts: $totalposts\nOnline Today: $numbertodayonline\n";

$worte split("\n"$text);
if(
is_array($worte)){
    
$i 0;
    foreach(
$worte as $wort){
    
$i++;
    
$output[$i] = $wort;
    }
}

$vorlage imagecreatefromjpeg("$vorlagedatei"); 
$img imagecreatetruecolor($width,$height);

//a png uses ImageColorAllocate instead of ImageColorClosest like jpeg uses
$bg_color imagecolorallocate ($img255255255); //background white
$text_color imagecolorallocate ($img000); //black text
imagefilledrectangle ($img00$width$height$bg_color);

imagecopy ($img$vorlage0000$width$height); // copy empty banner

imagecolortransparent($img$bg_color);  // set dummybg transparent
 
// the distance is in pixels and the font # is 1 through 5
$i 0;
while(
$i count($output)){
imagestring($img2$left, (($i $zeilenabstand) - $zeilenabstand $top), $output[$i], $text_color);
$i++;


header("Content-Type: image/png");
imagepng($img); 
imagejpeg($img"$ausgabedatei",$komprimierung); //Write jpg to folder and set compression 
imagedestroy($img); // get the image out of memory
?>
But as soon as i upload that new sig-code i get the following ERROR:

Code:
Fatal error: Call to a member function on a non-object in /is/htdocs/42170/www.e34m5.de/board/signature2.php on line 77
and the on line 77 in my signature2.php is:


PHP Code:
    $DB_site->query("UPDATE template SET template='$maxloggedin' WHERE title='maxloggedin'"); 

What am i doing wrong?!!?
Reply With Quote
  #210  
Old 10-28-2003, 03:43 PM
ogden2k's Avatar
ogden2k ogden2k is offline
 
Join Date: Apr 2003
Posts: 192
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How do I add an option to show how many users are online?
Reply With Quote
  #211  
Old 10-29-2003, 12:06 PM
irn-bru's Avatar
irn-bru irn-bru is offline
 
Join Date: Feb 2002
Location: Scotland
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thx m8
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:19 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05806 seconds
  • Memory Usage 2,442KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete