Version: 1.00, by tkeil69575
Developer Last Online: Sep 2007
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.
$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.
$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 == 1 ) {
$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 == 2 ) {
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);
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($img, 2, $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 == 1 ) {
$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 == 2 ) {
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;
}
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($img, 2, $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'");