PDA

View Full Version : VBStats version 1.0


30 Oct 2000, 16:49
VBStats version 1.0

This hack creats some graphical statistics of your vBulletin Forum.

Demo1, this shows some general statistics about your board (posted posts, posted threads, new users)

http://feyenoordforever.nl/forum/stats/vbstats.php?action=vbstats

Demo2, this shows the posting statistics of a particular member (in this case memberid 1 which is me)

http://feyenoordforever.nl/forum/stats/vbstats.php?action=userstats&userid=1

You can sort everything per month, per week or per day.

It uses the Ykcee class (http://ykcee.sourceforge.net)
Note: It works ONLY if your server has installed the GDLIB library!
Follow the following orders very carefully. There are no changes for you vBulletin files needed

First download the zip-file: http://www.feyenoordforever.nl/vbhacks/VBStats.zip

1- Open "vbstats.php" and change the variables on top to your needs. (For explanation of the ykcee variables go to: http://ykcee.sourceforge.net/index.php?MAINNAV=2)
2- If your server is running a PHP version smaller than 4.0 then uncomment the array_slice function in "vbstats.php" (eg: remove /* and */ and the 'Uncomment this if you have a PHP version smaller than 4.0' line)
3- Make a new directory into your vBulletin root directory and call it "stats".
4- Copy "vbstats.php", "ykcee.php", "VERDANA.TTF", "VERDANAB.TTF" and "VERDANAI.TTF" to this directory.
5- Chmod vbstats.php to 755 if you're server is running php in cgi-mode.
6- Make a new template in your vBulletin control panel called "vbstats"
7- Insert the following HTML in it (You can change it to your own design, only leave the $orderby variable and the "action", "max" and "orderby" fields):

<html
<head><title>$bbtitle Statistics</title></head>
<body bgcolor="#7d7092" text="#000000" id=all leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000000" vlink="#000000" alink="#000000">
<form method="POST">
<table width="100%">
<tr>
<td align="center">
<table>
<tr>
<td align="center">
<img src="vbstats.php?orderby=$orderby&what=users&max=$max&increased=$increased">
</td>
</tr>
<tr>
<td align="center">
<img src="vbstats.php?orderby=$orderby&what=posts&max=$max&increased=$increased">
</td>
</tr>
<tr>
<td align="center">
<img src="vbstats.php?orderby=$orderby&what=threads&max=$max&increased=$increased">
</td>
</tr>
<tr>
<td align="center">
<input type="hidden" name="action" value="vbstats">
<input type="hidden" name="max" value="15">
<b><smallfont>Increasing?</b></smallfont><INPUT type="checkbox" value="true" name="increased">
<select name="orderby">
<option value="month">Per month</option>
<option value="week">Per week</option>
<option value="day">Per day</option>
</select>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body></html>

8- Create somewhere you want in your forumtemplates a link to "http://yourdomain.com/forum/stats/vbstats.php?action=vbstats"
9- Create a new template in your control panel called "memberstats"
10- Insert the following HTML in it (You can change it to your own design, only leave the $orderby and $userid variables and the "action", "max" and "orderby" fields):

<html
<head><title>$bbtitle Member Statistics</title></head>
<body bgcolor="#7d7092" text="#000000" id=all leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000000" vlink="#000000" alink="#000000">
<form method="POST">
<table width="100%">
<tr>
<td align="center">
<img src="vbstats.php?orderby=$orderby&what=members&userid=$userid&max=$max&increased=$increased">
</td>
</tr>
<tr>
<td align="center">
<input type="hidden" name="action" value="userstats">
<input type="hidden" name="userid" value="$userid">
<input type="hidden" name="max" value="15">
<b><smallfont>Increasing?</b></smallfont><INPUT type="checkbox" value="true" name="increased">
<select name="orderby">
<option value="month">Per month</option>
<option value="week">Per week</option>
<option value="day">Per day</option>
</select>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body></html>

11- Create a link to "http://feyenoordforever.nl/forum/stats/vbstats.php?action=userstats&userid=$userid" in your "getinfo" template (the template for the userprofiles)

OR

insert just a little html in the "getinfo" template to show the image directly:

<img src="stats/vbstats.php?vbstats.php?orderby=week&what=members&userid=$userid">

(change the orderby variable to suit your needs)

That's it!

The "max" variable is to set a maximum of the displayed days/weeks/months...otherwise you had to much of them and the image got real messy.
You can change it if you want or let the user choose the max value by creating a dropdownlist or a input field in your template called 'max'

The only problem I have is that if there is a period of inactivity the graphic isn't represented as it should,
(see the 'geplaatste threads' graphic at http://feyenoordforever.nl/forum/stats/vbstats.php?action=vbstats&orderby=month )
and note how there ar a few months missing...In fact the space between januari and july should be bigger than it is, but it's too complicated to fix that....
I might fix it later...

Let me know what y'all think

enjoy!

Forgot the download link...DOH!

[Edited by Mas*Mind on 11-01-2000 at 04:49 PM]

30 Oct 2000, 22:32
I installed it on my board, but frist I had to clean up some small mistakes!

http://www.startrek-download.de/vbb/stats/vbstats.php?action=vbstats

Great work, but look over your readme again, I found a lot of small misstakes!

30 Oct 2000, 23:20
Can you give some detailed information? Because I can't find anything I forgot/told wrong...

Btw: You can change the colors of the graphics to suit your site...Look into the vbstats.php

30 Oct 2000, 23:41
sorry to sound ignorant, how do i know if the GDlib library is installed? a friend installed php for me and i don't know.

Thanks

30 Oct 2000, 23:45
Create a php-script with the following code in it:


<?php

phpinfo();

?>


Then call that script from your webbrowser and it'll tell you somewhere if GDLib is enabled

EG: http://feyenoordforever.nl/phpinfo.php

And search there for GD, it says for me:

GD Support enabled
GD Version between 1.3 and 1.6.1
FreeType Support enabled
FreeType Linkage with TTF library
GIF Support enabled

BTW: If your GD-version only supports another file-format (png for example) you can change it in vbstats.php:

$graph->SetFileFormat("gif");

'gif', 'jpg' and 'png' are supported

30 Oct 2000, 23:59
http://www.ascifi.com/refer/phpinfo.php

GD Support enabled
GD Version between 1.3 and 1.6.1
GIF Support enabled

yipee :) guessing that is enough.

Question:

The graphs do posts/month, user/month etc. What about a graph for over time, ie one that steadily rises but you can see it going up and up and up. What do you think? I would like that.

Cool hack, really original. Thanks.

31 Oct 2000, 00:03
I don't think I understand that last suggestion...

You mean a more fluid (is that the right word in english?) line in stead of one that goes from point to point in straight lines?

tell me plz :)

31 Oct 2000, 00:06
nope. At the moment it plots:

January : 156 posts
February : 212 posts
March : 131 post etc.

I would also like if possible:

January : 156 posts
February : (Jan + February) = 368
March (Jan + Feb + March) = 499

so you get a graph that shows the forum growing over time.

31 Oct 2000, 00:12
Ah yes...

I thought about that and will look into that when I've time

31 Oct 2000, 00:22
cool, thanks. Again, great hack!

31 Oct 2000, 00:24
didn't work for me... just came up blank

mine says


GD Support enabled
GD Version between 1.3 and 1.6.1
GIF Support enabled


but didn't work ?

31 Oct 2000, 00:35
i am not sure, but ain't templates 'vbstats' and 'memberstats' meant to be referenced in global.php as well for the templates to work ? can't remember is it global.php in admin directory or forum ?

31 Oct 2000, 02:33
Originally posted by Mas*Mind
Create a php-script with the following code in it:


<?php

phpinfo();

?>


Then call that script from your webbrowser and it'll tell you somewhere if GDLib is enabled

EG: http://feyenoordforever.nl/phpinfo.php

And search there for GD, it says for me:

GD Support enabled
GD Version between 1.3 and 1.6.1
FreeType Support enabled
FreeType Linkage with TTF library
GIF Support enabled

BTW: If your GD-version only supports another file-format (png for example) you can change it in vbstats.php:

$graph->SetFileFormat("gif");

'gif', 'jpg' and 'png' are supported

You don't have to create a new script... Just call the index.php in your admin folder with an action of phpinfo.

i.e. http://yourforum.com/youradmin/index.php?action=phpinfo

31 Oct 2000, 08:50
Eva > Nope, there is absolutely no need to change anythying in the Vbfiles...
I've no clue what could be wrong, but The_Sisko allready said my manual was incomplete so I may forgot something (I don't know what it might be :o)
What do you mean by blank? Doesn't an image show up at all? Don't you even see the form button/select field?
More info plz, and an URL if you have that.

wluke > Thanks! didn't know that

31 Oct 2000, 10:08
Originally posted by Mas*Mind
Can you give some detailed information? Because I can't find anything I forgot/told wrong...

Btw: You can change the colors of the graphics to suit your site...Look into the vbstats.php

First off all I tried to change it, but didn't realy fit. I try it later again!

I overlook my changes and find maybe I made a mistake and fixed thsi one and had so had to fix some more....

But still you said make a link to:
http://feyenoordforever.nl/forum/stats/vbstats.php?action=fmbstats
but I thing it ahve to be:
http://feyenoordforever.nl/forum/stats/vbstats.php?action=vbstats
otherwise a blank page shows up.

So you also have to change in the first template the line:
<input type="hidden" name="action" value="fmbstats">
to
<input type="hidden" name="action" value="vbstats">

Otherwise it woukd work for me.
Oh and I I had to use png in the vbstats.php, but this is only for my Server!

Tell me if this is corect or do I make a mistake, then I apologize.

P.S.: Also close in the first template the <HTML> TAG, thats it.

31 Oct 2000, 10:29
Two stupid mistakes of me :o

I changed the above readme in this thread and will change the README.TXT in the zipfile...

Thanks for pointing that out...

Eva2000 > I think this was your problem, change the template where it says

<input type="hidden" name="action" value="fmbstats">

and change it to

<input type="hidden" name="action" value="vbstats">

And point your browser to: http://yourdomain/to/your/vbforum/stats/vbstats.php?action=vbstats

Let me know if it worked...

31 Oct 2000, 10:40
OK, and another question. There is a 3D effekt in the title text. Where do I find the "white" for the backcolor of the 3D Text?

And the above suggestion to show the forum rising in a bar would be great.

Thanks for the great script!

31 Oct 2000, 10:55
I don't think there is one, but you can turn the shading off by setting:

$graph->SetShading(1);

to

$graph->SetShading(0);

in vbstats.php

Btw: The link to your forum underneath your logo on your stats page isn't right, now it points to: http://www.startrek-download.de/vbb/stats/index.php
while it should point to: http://www.startrek-download.de/vbb/index.php

I'll take alook into the rising thing..maybe today :)

31 Oct 2000, 10:59
If you wanna change the shading color you'll have to change some code in ykcee.php, the color is hardcoded in the class (weird)


if ($this->shading == 1) {
list($r, $g, $b) = ColorSet("silver");


So change 'silver' to one of the appropiate colors

31 Oct 2000, 13:07
ups, it's my bad english, I was talking about the shading, but didin't find the right word, so I tried to explain it with 3D effect :D. Anyway, work perfect now.

31 Oct 2000, 19:15
I forgot an extra field in the "memberstats" template:

insert:

<input type="hidden" name="userid" value="$userid">

beneath:

<input type="hidden" name="action" value="userstats">

That's it

01 Nov 2000, 20:59
Ok, Chris; Your wish is fullfilled, the stats also support now an increasing line, demo:

http://feyenoordforever.nl/forum/stats/vbstats.php?action=vbstats

Just check the "oplopend?" checkbox en click on submit...

I updated the first message in this thread AND the readme.txt in the zipfile, so if you're installing this for the first time you'll be fine.

If you allready installed the hack there are a couple of thing you need to do:

1) Download the updated zipfile (http://feyenoordforever.nl/vbhacks/VBStats.zip) and replace your existing "vbstats.php" with the new one

2) Edit the "memberstats" template:

Change

<img src="vbstats.php?orderby=$orderby&what=members&userid=$userid">

to

<img src="vbstats.php?orderby=$orderby&what=members&userid=$userid&max=$max&increased=$increased">

and add:

<b><smallfont>Increasing?</b></smallfont><INPUT type="checkbox" value="true" name="increased">

before:

<select name="orderby">

3) Edit the "vbstats" template:

change:

<img src="vbstats.php?orderby=$orderby&what=users">

to:

<img src="vbstats.php?orderby=$orderby&what=users&max=$max&increased=$increased">

change:

<img src="vbstats.php?orderby=$orderby&what=posts">

to:

<img src="vbstats.php?orderby=$orderby&what=posts&max=$max&increased=$increased">

change:

<img src="vbstats.php?orderby=$orderby&what=threads">

to:

<img src="vbstats.php?orderby=$orderby&what=threads&max=$max&increased=$increased">

and add:

<b><smallfont>Increasing?</b></smallfont><INPUT type="checkbox" value="true" name="increased">

before:

<select name="orderby">

(the updated parts are in bold)

That's it!

Let me know if it worked :)

[Edited by Mas*Mind on 11-01-2000 at 05:09 PM]

01 Nov 2000, 21:57
Updated it and worked perfect!!! :D

Thanks for this great hack!

03 Nov 2000, 13:10
wow,,, that is brilliant.

now problem installing !

if i do this url:

http://www.ascifi.com/forums/vbstats/vbstats.php?action=vbstat&sorderby=month&what=users&max=15&increased=true

i get all sorts of errors about no TTF in this build. What do i change to make it use Gif which is supported?

Also, just doing http://www.ascifi.com/forums/vbstats/vbstats.php?action=vbstats just gives blank images. Is this because of the above problem?

I would love to see this hack on my site, thanks so much for the work.

03 Nov 2000, 19:17
Requirements

This class was developed on Linux 2.2.14, Apache/1.3.12 with PHP 4.0.1pl2, GD Version 1.8.3, PNG-Support and TTF-Support enabled. (http://ykcee.sourceforge.net/index.php?MAINNAV=2)

Guess you'll have to enable TTF support, I'm no expert on installing PHP on linux so I can't help you on this :(

03 Nov 2000, 19:28
arrrr.ok

04 Nov 2000, 19:42
I'm having the same problem as eva2000 - the page just comes up totally blank:
http://www.edevboards.com/stats/vbstats.php?action=vbstats

04 Nov 2000, 22:06
Did all of you overlooked their code after we find the little errors? I got the same prob like eva but could fix it with the above code.

Also look or try if it works when you change from gif --> png --> jpg. I had to do so.

05 Nov 2000, 07:12
No it still doesn't seem to work. I've gone through all the code changes you have said in this thread, and tried both gif and png (those are the only two my server supports.).
Any more suggestions anyone? :)

05 Nov 2000, 09:59
I'm stumped on this :(

Try this:

Put this function:

function debug($line, $debug)
{ if($debug)
print "$line<br>\n";
}

beneath the increased function in vbstats.php (all the way down)

and put this line:

debug(__line__, $debug);

a couple of times between de code in vbstats.php...Try to put it on every spot between de "case this" etc...

so it may look like this:

case "userstats" :
debug(__line__, $debug);
$what = $GLOBALS[what];
$max = $GLOBALS[max];
$orderby = $GLOBALS[orderby];
$userid = $GLOBALS[userid];
$increased = $GLOBALS[increased];
eval("echo dovars(\"".gettemplate("memberstats")."\");");
break;
case "vbstats" :
debug(__line__, $debug);

etc..

Then run the script again

but with &debug=1 on the end...Then you can follow it and see where it stops...

This won't solve the problem, but we'll be able to see what goes wrong (I hope)

05 Nov 2000, 12:32
OK after fuming over this all morning :D I managed to solve the problem by playing with the file and downloading a new copy of vbstats.php. I'm guessing it got corrupted somewhere along the line...
http://www.edevboards.com/stats/vbstats.php?action=vbstats
Thanks for your help...sorry if I wasted your time with the problem..should have tried redownloading first :D

05 Nov 2000, 12:48
Looks good! Glad it works now :)

12 Nov 2000, 22:11
Cann someone please help?
http://www.glidetech.com/forums/stats/vbstats.php?action=vbstats

http://www.glidetech.com/phpinfo.php

Just broken images :(

Thanks

13 Nov 2000, 14:55
666 views... the devil must be playing with it :D

TechTalk, are you sure GD is working? Can't think of any other explanation..

13 Nov 2000, 17:00
What graphics format have you set? Your phpinfo page suggests that GIF is a good choice :)
I originally set the wrong one when installing this hack and got the same problem as you. Changing it to GIF fixed the problem on my board :)

13 Nov 2000, 17:19
Hmm I currently do have it set to "gif". How would I know if GD is working?

Thanks

13 Nov 2000, 20:12
The problem is you don't have TTF-Support enabled....:(

13 Nov 2000, 21:53
Originally posted by Mas*Mind
The problem is you don't have TTF-Support enabled....:(

How would I go about enabling that? Does php.ini have such a setting or is it a matter of re complilng?

Thanks

~Chris

13 Nov 2000, 22:19
I honestly don't know... :o

13 Nov 2000, 22:20
(I'm not incredibly informed, so keep that in mind)
I believe you'll have to recompile and I believe there is a GD switch or two that you need. Something like --with-gd and/or --with-gdttf

[Edited by Ed Sullivan on 11-13-2000 at 06:25 PM]

27 Dec 2000, 13:00
Great hack. Can I see one done in english?

30 Dec 2000, 07:09
ImageTtfBBox: No TTF support in this PHP build in /home/httpd/html/forum/stats/ykcee.php on line 436


I got this error for the images. What's wrong.

30 Dec 2000, 07:55
Originally posted by theprof
ImageTtfBBox: No TTF support in this PHP build in /home/httpd/html/forum/stats/ykcee.php on line 436


What Version of PHP are you running on your server?

30 Dec 2000, 09:29
http://www.adolescentadulthood.com/phpinfo.php

You can get the info from there.

It's 4.0.3pl1 I think that perhaps my webhost hasnt installed ttf support, and i've asked them to do it for me.

30 Dec 2000, 09:39
thats the most likely reason :)

01 Jan 2001, 00:47
This is what my webhost said:

I have recompiled your php with version 4.0.4. According to http://www.adolescentadulthood.com/info.php ttf support is included in this build of php. However, ttf support is shown to be not included by http://www.adolescentadulthood.com/forum/stats/vbstats.php?orderby=&what=users&max=15

Can anybody help?

01 Jan 2001, 01:06
You need to compile TTF support into the GD library...

It should be:
gd
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
GIF Support enabled

01 Jan 2001, 05:47
Thank you. I will notify them immediately. I dont dare mess with the settings myself.

27 Jan 2001, 18:00
i had to change my $graph->SetFileFormat("gif"); to png ($graph->SetFileFormat("png");) because i am running gd 1.8.3. but somehow all the images turn out to be fully black (nothing else)

another question i saw someone running a gd version highter than 1.6.2 with GIF support ? i thought they removed GIF support since version 1.6 due to legal problems ... ?

any help here is appreciated

thanks in advance

[edit]:
my gd specs.

GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
PNG Support enabled

06 Feb 2001, 17:15
Hi there i was just wondering if one of you ever find why we get broken image...i have read all the tread make the change but still get this broken image if someone ever figure out plz let me know

btw cool hack

13 Feb 2001, 12:25
this is the mysql error i get

Database error in vBulletin: Invalid SQL: SELECT username FROM user
WHERE userid =
mysql error: You have an error in your SQL syntax near '' at line 1
mysql error number: 1064
Date: Tuesday 13th of February 2001 01:23:17 PM
Script:
/vb/stats/vbstats.php?orderby=&what=members&userid=&max=15&increased=
Referer:


and this are my gd option

GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
JPG Support enabled
WBMP Support enabled

14 Feb 2001, 11:35
ok i have solve the problem its alwais work better when you right jpg insted of jgp ;)

we gone have it

SilverBoy
09 Apr 2001, 00:58
I wanna translate the words that appear in the graphs, help plz.

Jarrod
13 Apr 2001, 02:01
I cant download the hack anymore. There seems to be a problem with your DNS Mas*Mind.
Also, I would love to see an english version of the hack too.

Mas*Mind
13 Apr 2001, 07:37
Link's fixed...I see what I can do about an English version

SilverBoy
15 Apr 2001, 12:21
I wish some one who is have an english demo put the link here coz I want to translate the hack too ;).
or plz MAssMind change the code to english, plz .

SilverBoy
17 Apr 2001, 14:56
ummmmmmmm......

Mas*Mind
17 Apr 2001, 15:04
It's easy to translate...Just open vbstats.php and change

$AxisXmonth = "Per maand";
$AxisXweek = "Per week";
$AxisXday = "Per dag";
$AxisY = "";
$noDataText = "Sorry, op dit moment is er geen data beschikbaar";
$dayFormat = "%a %e %b %Y";
$weekFormat = "Week %u";
$monthFormat = "%b %Y";
$memberStatsTitle = "Geplaatste posts door %s";
$memberStatsLegend = "Geplaatste Posts";
$postStatsTitle = "Geplaatste posts";
$postStatsLegend = "Nieuwe posts";
$threadStatsTitle = "Geplaatste threads";
$threadStatsLegend = "Nieuwe threads";
$userStatsTitle = "Nieuwe leden";
$userStatsLegend = "Nieuwe leden";

to

$AxisXmonth = "Per month";
$AxisXweek = "Per week";
$AxisXday = "Per day";
$AxisY = "";
$noDataText = "Sorry, not data available at this moment";
$dayFormat = "%a %e %b %Y";
$weekFormat = "Week %u";
$monthFormat = "%b %Y";
$memberStatsTitle = "New posts by %s";
$memberStatsLegend = "New Posts";
$postStatsTitle = "New Posts";
$postStatsLegend = "New Posts";
$threadStatsTitle = "New Threads";
$threadStatsLegend = "New Threads";
$userStatsTitle = "New Members";
$userStatsLegend = "New Members";

SilverBoy
18 Apr 2001, 18:56
if I want to change the font how I can do it, becaust my language doesn't suport this font, and how I can add vbtitle image and header and footer and fivelinks template to the templates, I tried it but failed. thx again :cool:

Mas*Mind
18 Apr 2001, 19:31
First q:

Upload the new font to the stats dir

then change:

$graph->SetTitleFont("./VERDANA.TTF");
$graph->SetFont("./VERDANA.TTF");

in vbstats.php to reflect the new font

Second q:

Currently you can't....

SilverBoy
18 Apr 2001, 21:42
may I to know? :)

Mas*Mind
18 Apr 2001, 22:37
because I didn't implemented it ;)

SilverBoy
18 Apr 2001, 22:46
so plz implemente it soon, ok ;)

SilverBoy
19 Apr 2001, 00:48
I changed the font to tahoma because I wrote the words with arabic language which this font suport them but all words displaied as garpeg.

Mas*Mind
30 May 2001, 01:22
I just found out this hack does work for 2.0:

Board stats (http://feyenoord.messagebase.nl/vbstats.php?action=vbstats)

User stats (http://feyenoord.messagebase.nl/vbstats.php?action=userstats&userid=497)