a sig thingy...

Started by z3rb, May 17, 2005, 01:48:56 PM

Previous topic - Next topic

z3rb

i saw this:
http://www.ipodwizard.net/signature.php

and thought, is this possible with SMF, if so, how would i do it?

Oldiesmann

[img]http://www.ipodwizard.net/signature.php[/img]
Michael Eshom
Christian Metal Fans

z3rb

#2
no, i mean make my own, for my own forum. :)

http://z3rb.kprhosting.com/forums/index.php

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

z3rb


z3rb

ok, ive got the code, but its for vBulletin... :-[ would it be easy to port?

this is the error im gettin


Warning: main(./global.php): failed to open stream: No such file or directory in /home/barnes/public_html/signature.php on line 7

Fatal error: main(): Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/barnes/public_html/signature.php on line 7

Owdy

Could you show the code?
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

z3rb

<?php
error_reporting
(E_ALL & ~E_NOTICE);

define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''sig_stats');

require_once(
'./global.php');


//DB-Servername
$host "localhost";

//DB-Username
$user"not telling you...";

//DB-Password
$password"not telling you...";

//vbulletin database name
$database="not telling you...";

//E-Mail Address where MySQL Error Messages are sent to
$adminemail "[email protected]";


//Width of banner image
$width 300;

//Height of banner image
$height 50;

//Left text-margin
$left 7;

//text-margin from top
$top 63;

//Font Size
$fontsize 8;

//If you have GD2 or higher set $sgdver to 1, for any older GD version set $sgdver to 0
$sgdver 1;

//If you wish to use a TrueType font set $ttfe to 1, for default php font set $ttfe to 0
$ttfe 1;

//If you wish to use a TrueType font, please enter the location to the .ttf file below
$ttff "http://www.ipodwizard.netsig/FRAHV.TTF";

//Line-spacing of text
$zeilenabstand 15;

//full path to empty signature image (input image)
$vorlagedatei "http://www.ipodwizard.net/home/ipodwiz/public_html/sig/sig.jpg";

//full path to signare image with forum data (output image)
$ausgabedatei "http://www.ipodwizard.net/home/ipodwiz/public_html/sig/signature.jpg";

//Compression of output image
$komprimierung 0;

//debug mode
$debug 0;


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;
   }
}

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

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


$datecut TIMENOW $vboptions['cookietimeout'];
$numbervisible 0;
$numberregistered 0;
$numberguest 0;

$forumusers $DB_site->query("
SELECT
user.username, (user.options & 
$_USEROPTIONS[invisible]) AS invisible, user.usergroupid,
session.userid, session.inforum, session.lastactivity,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " 
TABLE_PREFIX "session AS session
LEFT JOIN " 
TABLE_PREFIX "user AS user ON(user.userid = session.userid)
WHERE session.lastactivity > 
$datecut
ORDER BY " 
iif($permissions['genericpermissions'] & CANSEEHIDDEN'invisible ASC, ') . "username ASC, lastactivity DESC
"
);

if ($bbuserinfo['userid'])
{
$bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']);
$userinfos = array
(
$bbuserinfo['userid'] => array
(
'userid' => $bbuserinfo['userid'],
'username' => $bbuserinfo['username'],
'invisible' => $bbuserinfo['invisible'],
'inforum' => 0,
'lastactivity' => TIMENOW,
'musername' => fetch_musername($bbuserinfo'joingroupid')
)
);
$numberregistered 1;
$numbervisible 1;
$loggedin $userinfos["$bbuserinfo[userid]"];
eval('$activeusers = ", ' fetch_template('forumhome_loggedinuser') . '";');
}
else
{
$userinfos = array();
}
$inforum = array();

while ($loggedin $DB_site->fetch_array($forumusers))
{
$userid $loggedin['userid'];
if (!$userid)
{
$numberguest++;
$inforum["$loggedin[inforum]"]++;
}
else if (empty($userinfos["$userid"]['lastactivity']) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity']))
{
$userinfos["$userid"] = $loggedin;
$numberregistered++;
if ($userid != $bbuserinfo['userid'])
{
$inforum["$loggedin[inforum]"]++;
}
$loggedin['musername'] = fetch_musername($loggedin);
}
}


$activeusers substr($activeusers 2);

$DB_site->free_result($loggedins);

$totalonline $numberregistered $numberguest;



    
$holedinge $DB_site->query("SELECT forum.forumid, threadcount, replycount FROM " TABLE_PREFIX "forum AS forum");
        if (
$DB_site->num_rows($holedinge))
        {
            while (
$holeding $DB_site->fetch_array($holedinge))
            {
                if (empty(
$focache["$holeding[forumid]"]))
                {
                    
$focache["$holeding[forumid]"] = array();
                }
                
$focache["$holeding[forumid]"] = array_merge($focache["$holeding[forumid]"], $holeding);
            }
        }

    
$DB_site->free_result($holedinge);

    if (
is_array($focache))
        {
            foreach (
$focache AS $forum)
            {
                
$nthreads += $forum['threadcount'];
                
$nposts += $forum['replycount'];
                
$totalthreads number_format($nthreads);
                
$totalposts number_format($nposts);
            }
        } 



//Output text
$output "Members: $numbermembers Threads: $totalthreads Posts: $totalposts Online: $totalonline";

$vorlage imagecreatefromjpeg("$vorlagedatei");

if (
$sgdver == "1")
{
$img imagecreatetruecolor($width,$height);
} else {
$img imagecreate($width,$height);
}



$bg_color imagecolorallocate ($img250250250);

//EDIT: Text Colour
$text_color imagecolorallocate ($img,243,243,243);



imagefilledrectangle ($img00$width$height$bg_color);
imagecopy ($img$vorlage0000$width$height);
imagecolortransparent($img$bg_color);  

$i 0;
while(
$i count($output)){

if (
$ttfe == "1")
{
imagettftext($img$fontsize0$left, (($i $zeilenabstand) - $zeilenabstand $top), $text_color$ttff$output);
} else {
imagestring($img$fontsize$left, (($i $zeilenabstand) - $zeilenabstand $top), $output$text_color);
}
$i++;
}

header("Content-Type: image/png");
imagepng($img);
imagejpeg($img"$ausgabedatei",$komprimierung);
imagedestroy($img);
?>


sorry, forgot to post that.

z3rb

oh, and the bits that say "im not telling you..." are there, as i dont want ou knowing my SqL details. :-X

Ben_S

You can get the required information with ssi.php.

Do a search of this forum for ssi.php and then use that to get the number of posts etc dispencing with all the mysql stuff in there.
Liverpool FC Forum with 14 million+ posts.

z3rb


z3rb

bearing in mind, i REALY dont know php.

rakuli

SSI FAQ's

This is as good a starting point as any.

z3rb

right, ive read those, but they dont help me with my problems.

z3rb


Jonny555

I think THIS might be what your looking for.

Advertisement: