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 == 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);
$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 ($img, 255, 255, 255); //background white
$text_color = imagecolorallocate ($img, 0, 0, 0); //black text
imagefilledrectangle ($img, 0, 0, $width, $height, $bg_color);
imagecopy ($img, $vorlage, 0, 0, 0, 0, $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($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;
}
$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']==1 and $bbuserinfo['usergroupid']!=6) {
$numbertodayonlineinvisible++;
continue;
}
if ($todayuser['invisible'] == 1) { // Invisible User but show to Admin
$invisibleuser = '*';
}
if ($todayuser['usergroupid'] == 6 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 ($img, 255, 255, 255); //background white
$text_color = imagecolorallocate ($img, 0, 0, 0); //black text
imagefilledrectangle ($img, 0, 0, $width, $height, $bg_color);
imagecopy ($img, $vorlage, 0, 0, 0, 0, $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($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'");
What am i doing wrong?!!?
|