vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Forum stats on signature image (https://vborg.vbsupport.ru/showthread.php?t=50848)

insanctus 09-17-2003 08:34 PM

$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.

Almax1 09-17-2003 09:43 PM

PHP Code:

$text "Members: $numbermembers Threads: $totalthreads Posts: $totalposts\n"

fixed it thanx for your help m8

insanctus 09-17-2003 09:49 PM

n/p man , ack i forgot the \n at end :( sorry about that.

dstruct2k 10-08-2003 05:12 AM

Brand new version installed... All I get is a white page. The JPEGs aren't updating either.

dstruct2k 10-08-2003 05:25 AM

Oh, whoops. :o

Don't save PHPs as Unicode. :)

sweet22 10-13-2003 07:10 PM

i keep getting this error:
Quote:

Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/anima823/public_html/community/signature.php on line 83

dstruct2k 10-14-2003 06:06 AM

Quote:

Originally Posted by sweet22
i keep getting this error:

That's called not having GD2 installed. :)

M@rkus 10-15-2003 12:15 PM

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

But there is my problem right now.

Right now my Sig. looks like this:


http://www.e34m5.de/board/signature.php

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?!!?

ogden2k 10-28-2003 03:43 PM

How do I add an option to show how many users are online?

irn-bru 10-29-2003 12:06 PM

thx m8 :)


All times are GMT. The time now is 02:20 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01555 seconds
  • Memory Usage 1,891KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete