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 :)

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

cron jobs via php script - phpJobScheduler

http://www.hotscripts.com/Detailed/27136.html

FlyBoy73 11-05-2003 10:04 PM

Is it possible to run Multiple Banners with this stats hack in each different one? I would like to have about 5 different banners for one of my communities, each focusing on a specific area I want to reach out to..

Thanks,
David

AJR 11-12-2003 05:58 PM

Great hack! I've been looking at this one for awhile, but didn't have GD 2.0+ on my server. I finally spent an hour last night upgrading PHP and GD. I then installed this hack without any issues. Thanks again for this hack!

Intex 01-01-2004 09:06 AM

[high]* Intex clicks Install. Great hack :).
[/high]

Anybody have the adjusted code that displays Online users?

y2krazy 01-15-2004 10:52 PM

My image doesn't seem to be updating itself via the cronjob. Any tips on how to make sure it will update without having to run signature.php to update it manually?

-y2k-

robin_ge 01-29-2004 03:37 AM

Quote:

Originally Posted by Intex
[high]* Intex clicks Install. Great hack :).
[/high]

Anybody have the adjusted code that displays Online users?

Same here, thanks in advance.

BenS 03-09-2004 12:02 AM

Works on vB3 without any change in code! :D Great hack!

AJR 03-09-2004 02:59 AM

Quote:

Originally Posted by Intex
[high]* Intex clicks Install. Great hack :).
[/high]

Anybody have the adjusted code that displays Online users?

Attached is a text file that has instructions how to add the queries for Online users.

glo 03-10-2004 12:45 AM

will this work with gif images?

y2krazy 03-29-2004 08:38 PM

My cronjob doesn't seem to want to work with this...

What do I need to make sure I'm doing right so that it works? Thanks.

-y2k-

DannyBoy8406 04-08-2004 06:38 AM

anyone know an update for this for VB3?

StepFenz 04-10-2004 08:33 PM

Hope not everybody is sick and tired of answering the question. But I've thoroughly searched the thread and I couldn't find the answer.

Q: I have GD2 installed (i.e. phpinfo says: GD Version bundled (2.0 compatible)) and I've chmodded my targetdir to 777. But the picture file doesn't show up. I can run the signature.php file and then I see what I would like to see. But I want the image-file.

Can anybody help me? I know there were people in this thread with similar problems and I can see by their signature they've solved that :laugh:

Tnx in advance

Idea: You can easiliy put the picture file on your Windows desktop and have it refreshed as much as you like.

StepFenz 04-11-2004 01:50 PM

Ok,

I've commented all kinds of lines out to try to focus on the wrong line. I cannot find it.
Problem: I can't generate a picturefile, not a jpg not a png.

But: I can run de php.file, and I can see the png-file, exactly the way I like it. There are no error messages.

System: I have GD2 and php 4.3.0 installed. And chmodded the picturedir to 777. I have Photopost working with GD as well.

These are my last 4 lines:
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

Firstly: I want to know how to fix this, but secondly: why is the png file swapped into a jpeg? Can I skip that?)

StepFenz 04-13-2004 04:50 PM

Solved it! Don't ask me how, but it works. In order to improve the interaction on this thread ;-) : I also added the total number of pictures of my photopost-section. Here it is (note that my photopost prefix is pp, if yours is different change that in the query below, eg. you have xx as photopost prefix, change ppphotos into xxphotos):

find:
mysql_free_result($threada);

after that add:

//get total photos
$queryd="SELECT COUNT(*) AS ppphotos FROM ppphotos";
$ppphotosa = mysql_query_eval($queryd,$link);
$ppphotosb = mysql_fetch_array($ppphotosa);
$totalphotos=number_format($ppphotosb['ppphotos']);
mysql_free_result($ppphotosa);

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

Into:
$text = "Members: $numbermembers\nThreads: $totalthreads\nPosts: $totalposts\nPhoto's: $totalphotos\n";

I like this, because I now have immediately information on my frontpage about the status of all content, including photos.

PranK 04-26-2004 12:51 PM

this works without any dramas for VB3.

Christian

dstruct2k 04-29-2004 02:32 PM

Quote:

Originally Posted by PranK
this works without any dramas for VB3.

Christian

Mine had to be altered, although it might be because my new host only has GD 1.

Meh, whatever, it works. :)

kall 05-01-2004 10:59 AM

I quite liked this hack over on Invision boards, and was all excited to see it here...unfortunately, when I call signature.php, all I get are lots of

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in

errors.

Any ideas?

GoTTi 05-02-2004 04:43 AM

not working for v3 for me...

can ne1 help me with it...

GoTTi 05-04-2004 03:49 PM

ne1 got this working on vb3??????

DWard 05-24-2004 12:48 PM

Yer I developed the script for vb3, search for Signature Stats and you should find it :)

Scuzzy 04-07-2007 02:41 PM

I've been unable to get this to create the jpg when run as a cron job but it will if I call the php script directly... some others here have run into that problem, how did you solve it?

Thanks,
Scuzzy


All times are GMT. The time now is 04:21 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.01631 seconds
  • Memory Usage 1,953KB
  • 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
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (31)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