vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Signature Stats v3.04 (https://vborg.vbsupport.ru/showthread.php?t=65361)

venomx 04-24-2005 03:05 AM

Has to be jpg and it needs two because it edits one and over writes the other.

Brandon Sheley 04-24-2005 07:44 AM

okay, so i can make it a jpg, and then the two images are the same image ? just ones called sig and the other is signature ? or w/e the install says i don't have it right in front of me.. and.. does it automaticly type the info at the bottom of the sig.. like yours ? .thank you for the help


okay i made a simple banner, just to test things out. and im stillg etting an error.
i have these files uplaoded, and chmomd the folder,

here are the 2 image links

http://www.locoforum.com/sig/sig.jpg
http://www.locoforum.com/sig/signature.jpg

and this is my
http://www.locoforum.com/signature.php

Code:

<?php

// #######################################################################
// #######################################################################
// ##                                                                          ##
// ##                            SIGNATURE STATS V3.04                            ##
// ##                        ----------------------------                          ##
// ##                                By Dan Ward                                    ##
// ##                          www.collegepranks.co.uk                            ##
// ##                                                                  ##
// #######################################################################
// #######################################################################
// ########### developed from tkeil69575's script for 2.3.x ##############

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'sig_stats');

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

//////////////////////////////////////////////////////////////////////////
//
// Instructions
// ============
//
// Edit the 'ENTER DATABASE INFORMATION' and 'ENTER IMAGE INFORMATION' sections
// then edit the 'OUTPUT TEXT' and 'TEXT FORMATTING' sections
//
//////////////////////////////////////////////////////////////////////////

// #################### ENTER DATABASE INFORMATION #######################
//DB-Servername
$host = "localhost";

//DB-Username
$user= ".......";

//DB-Password
$password= ".......";

//vbulletin database name
$database="........";

//E-Mail Address where MySQL Error Messages are sent to
$adminemail = "iz_zy@email.com";

// ###################### ENTER IMAGE INFORMATION #########################

//Width of banner image
$width = 400;

//Height of banner image
$height = 98;

//Left text-margin
$left = 13;

//text-margin from top
$top = 70;

//Font Size
$fontsize = 7;

//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 = 0;

//If you wish to use a TrueType font, please enter the location to the .ttf file below
$ttff = "./verdana.ttf";

//Line-spacing of text
$zeilenabstand = 15;

//full path to empty signature image (input image)
$vorlagedatei = "/sig/sig.jpg";

//full path to signare image with forum data (output image)
$ausgabedatei = "/sig/signature.jpg";

//Compression of output image
$komprimierung = 95;

//debug mode
$debug = 0;

// ######################### 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 TO 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");

// GETTING FORUM MEMBERS
$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);

// GETTING TOTAL MEMBERS ONLINE

        $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'])
        {
                // fakes the user being online for an initial page view of index.php
                $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)
                {        // Guest
                        $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);
                }
        }

        // memory saving

        $activeusers = substr($activeusers , 2); // get rid of initial comma

        $DB_site->free_result($loggedins);

        $totalonline = $numberregistered + $numberguest;

//////////////////////////////////////////////////////////////////////////////////////////////////

// GETTING TOTAL POSTS AND THREADS
include_once('./includes/functions_forumlist.php');
cache_ordered_forums(1, 0, 0);
if (is_array($forumcache))
{
        foreach ($forumcache AS $forum)
        {
                $nthreads += $forum['threadcount'];
                $nposts += $forum['replycount'];
                $totalthreads = number_format($nthreads);
                $totalposts = number_format($nposts);
        }
}

// ########################### OUTPUT TEXT ###############################
// Use \n\r to make a line break (only for use with truetype font SO FAR)
// Will be developed to use with default font soon :)

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

// ########################## TEXT FORMATTING ############################

// A PNG uses ImageColorAllocate instead of ImageColorClosest like jpeg uses

//EDIT: Background/Transparency Colour (not really seen)
$bg_color = imagecolorallocate ($img, 250, 250, 250);

//EDIT: Text Colour
$text_color = imagecolorallocate ($img, 19, 36, 161);

// ######################### DO NOT EDIT BELOW ############################

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

if ($ttfe == "1")
{
imagettftext($img, $fontsize, 0, $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); //Write jpg to folder and set compression
imagedestroy($img); // get the image out of memory
?>

and if you look i stillg et an error :|

the last part of the install, do i need to do something here ?

###############################################
##
## DONE!!!
##
###############################################

All you need to do to have it as your signature is add this bbcode:
http://www.yourdomain.com/signature.php

NOTE: This does add a guest to your online users section as somebody views the signature, so the best thing to do, is add a cron task (not sure how) to call the script every 15 minutes or so, then use this bbcode:
http://www.yourdomain.com/sigfolder/signature.jpg

Brandon Sheley 04-25-2005 03:54 AM

ah, i see what my problem was..needed the full path to the images :) yeah!!. thx for the mod and help

Brandon Sheley 04-25-2005 04:16 AM

Quote:

Originally Posted by Watson
I cant get the line break to work, and I am using a ttf, any help on exactly where to put it.

I am doing it here

PHP Code:

// ########################### OUTPUT TEXT ###############################
// Use \n\r to make a line break (only for use with truetype font SO FAR)
// Will be developed to use with default font soon :)

//Output text
$output "Members: $numbermembers \n\r Threads: $totalthreads \n\r Posts: $totalposts";

$vorlage imagecreatefromjpeg("$vorlagedatei");

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




my next question is on this line break ? i pasted the \n\r just like htis user did, and i don't get line breaks, some some little letters, just wonding how i do the breaks, other then that, get work :P
thx for helping this n00b


nevermind, i tired a differant font and got it working just like i want. :P thx again.. peace



oh, this is what i came up with, i'll need to redo the graphic sometime, i'm better at coding then graphic's if that tells ya anything..lol


Watson 04-27-2005 12:08 PM

get this error and can't seem to sort it out

Code:

Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/bootleg/forums/signature.php on line 228

venomx 04-27-2005 03:54 PM

Man I love this hack but as you can see in my sig I have to keep making the image larger lol

Brandon Sheley 04-27-2005 05:38 PM

venomx you should just put a line break in it ?

and i have a little suggestion for the next release :) if you could put the page views used in PCFreaks site stats, that would be cool :)

brianstevz 04-27-2005 08:17 PM

Got it to work within 10 minutes. Great hack!

Watson 04-27-2005 10:09 PM

yeah I didnt have a problem either, was just after server change got that error I said above :(

|Jordan| 04-28-2005 02:19 AM

It doesn't have to be a jpeg. I edited the file to accept GIF and it works flawlessly. All you have to do is replace all instances of the word "jpeg" with "gif.

Jaxx 04-28-2005 09:51 AM

I see at least one of these now a day when visiting some of the other sites I frequent. Its spreading!!!

Brandon Sheley 04-28-2005 05:01 PM

Quote:

Originally Posted by MyIS_Jordan
It doesn't have to be a jpeg. I edited the file to accept GIF and it works flawlessly. All you have to do is replace all instances of the word "jpeg" with "gif.


cool. i figured as well, but just hadn't tried it yet, now i just wish my photoshop skills where a little better ..lol

Watson 04-29-2005 07:32 PM

anyone able to help me out with my little problem :):)

venomx 04-29-2005 07:44 PM

Looks like your host doesnt have the "imagecreatefromjpeg()" program installed...

Have you sent a support request to them asking why imagecreatefromjpeg() doesnt work?

Watson 04-30-2005 07:21 AM

yeah I got the latest gd and the other thing installed on me server mate

LuBi 05-12-2005 08:14 AM

Thanks got ours up after a little customizing! Thanks!

vB 3.0.1 (soon to be upgraded)
PHP 4.3.2
GD 2+

:up:

Mr. Brian 05-12-2005 11:18 AM

Is it a MUST for img code to be turned on? Or...?

LuBi 05-12-2005 09:48 PM

Quote:

Originally Posted by Mr. Brian
Is it a MUST for img code to be turned on? Or...?

well yeah, they're using a *.jpg in their sig which is generated by the signature.php

LuBi 05-15-2005 10:21 PM

Can we get this to align right? or center..? anything other then left? I tried but $left is left no matter what. :disappointed:

mholtum 05-15-2005 11:17 PM

use bb code. ie
HTML Code:

[right]path_to_image[/right]

MissKalunji 05-22-2005 09:42 AM

Dont know if this was asked before but will this work with 3.5.0? thx

venomx 05-22-2005 05:26 PM

3.5.0 isnt out yet.

MissKalunji 05-22-2005 07:41 PM

Quote:

Originally Posted by venomx
3.5.0 isnt out yet.


I know.....what im asking if does he intend to upgrade it FOR 3.5.0

DWard 05-23-2005 05:37 AM

Quote:

Originally Posted by MissKalunji
I know.....what im asking if does he intend to upgrade it FOR 3.5.0

If it's anything like the previous versions it wont be hard to alter the script for new vesions of vB

MissKalunji 05-23-2005 12:25 PM

Quote:

Originally Posted by DWard
If it's anything like the previous versions it wont be hard to alter the script for new vesions of vB

thx for replying

Jaxx 06-10-2005 10:06 AM

I just had to uninstall this. I was informed by the mods of vb.org that I could not have the sig since it creates a cookie in other people's browsers and is against the new rules of the site. :/

Thanks though for a good script.

*UPDATE*

I figured out how to do the cron and it now is only doing the jpg. So hope that fixed the cookie issue.

LuBi 06-10-2005 10:17 PM

Quote:

Originally Posted by mholtum
use bb code. ie
HTML Code:

[right]path_to_image[/right]

thanks but I was talking about the text generated over the jpg.. I looked into it and $left is a call of the code he's using.. $right should work.. but it doesn't. :disappointed:

i'd just like to align the text from the right.

Acers 06-13-2005 03:15 PM

i have set this up as a cron job of 15mins
with following settings:

Day of the Week *
Day of the Month *
Hour *
Minute 15
Log Entries No
Filename ./signature.php

but there is some problem. The stats are not getting updated. Though the job is running. However when i manually run the cron i get this error:
The image ?http://techenclave.com/forums/adminc...ron&cronid=21? cannot be displayed, because it contains errors.

but the stats get updated in the image. umm what could be wrong?

Acers 06-15-2005 05:40 PM

*bump*
umm any help plz

David_R 06-15-2005 11:21 PM

Acers have you setup your admincp dir correct in source files ?

Quote:

because it contains errors.
can you post what errors you are getting here ?

Acers 06-16-2005 01:09 AM

Quote:

Acers have you setup your admincp dir correct in source files ?
nope its the same as default

Quote:

can you post what errors you are getting here ?
well thats the error i am getting.


Code:

The image ?http://www.techenclave.com/forums/admincp/cronadmin.php?do=runcron&cronid=21? cannot be displayed, because it contains errors.
this is what i get when i manually run the cron from within Vbulletin. Although i get this error the image itself gets updated to latest stats.

http://www.techenclave.com/forums/si.../signature.jpg

but i have set the cron to run every hour, but it never does that. it gets stuck up the first time it has to run automatically. I have to manually click "run now" and i get this error but the ststs atleast get updated that way.


*btw after reading the previous posts, would it be better to run a cron from cpanel?

ogden2k 06-25-2005 08:13 PM

Is there are way to pull just the latest thread titles?

|Jordan| 07-25-2005 07:28 PM

The forum rules (on these forums) have changed and MarcoH64 said dynamic sigs cant be used anymore, but he said that if its changed to static than it can be used. Any idea how to make the image static (it will updated after a set amount of time in cron job)?

Mythotical 08-08-2005 06:18 AM

Is there a way to make it so the Newest User shown is clickable that will link to the members profile from a site, say in mine it will link to the member profile of my site?

I am working to hack a bit at this and modify it some, once complete I will just send you the core code so you can include that on the next release.

|Jordan| 08-28-2005 09:26 PM

Any idea how to stop this hack from using cookies? (or stopping vb from assigning cookies to guests?)

MissKalunji 09-01-2005 10:04 PM

Quote:

Originally Posted by MissKalunji
Dont know if this was asked before but will this work with 3.5.0? thx


anyone?

Brandon Sheley 09-13-2005 05:37 AM

Quote:

Originally Posted by MissKalunji
anyone?

ditto.. i'd like to use this for 3.5.0 :)

MissKalunji 09-13-2005 12:36 PM

Quote:

Originally Posted by Loco Macheen
ditto.. i'd like to use this for 3.5.0 :)


same here!!

|Jordan| 09-19-2005 08:14 PM

Is there any way to use the script on another server and have it point to the server that vb is running off of? The server that my website is running off of does not have GD library installed, but an old server (that i have access to) does.

GoTTi 09-23-2005 07:45 PM

where is sig.jpg @???


All times are GMT. The time now is 11:53 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.01994 seconds
  • Memory Usage 1,887KB
  • 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
  • (3)bbcode_code_printable
  • (2)bbcode_html_printable
  • (1)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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