Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-25-2001, 05:33 PM
Kevlar's Avatar
Kevlar Kevlar is offline
 
Join Date: Nov 2001
Location: Ft. Lauderdale, FL.
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Alright, I'm new here... and I tried looking around but couldn't find anything like this yet.

Has anybody done like a VB stats hack? I mean to get some cool information like this?

http://www.bimmerforums.com/stats.php ?

I got most of it working, I just can't get the "most users online" feature to work. It always says the most users online is current user count.

Any ideas?

FYI... this is my first time coding PHP so if I overlooked something simple... give me a break, I'm still learning.
Reply With Quote
  #2  
Old 08-25-2001, 06:24 PM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I believe there are currently two people working on vb stats currently.

Znaper is working on one at http://www.german-community.de/statistik.php

And I am working on one as well.

As far as the record users, I can try playing with that a bit and try to figure something out.
Reply With Quote
  #3  
Old 08-25-2001, 06:56 PM
JoshFink JoshFink is offline
 
Join Date: Nov 2001
Posts: 207
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bane, have you had any luck oin the stats code? I'm just trying to figure out if I should start my own or wait for others.

Thanks,

Josh
Reply With Quote
  #4  
Old 08-25-2001, 06:57 PM
Kevlar's Avatar
Kevlar Kevlar is offline
 
Join Date: Nov 2001
Location: Ft. Lauderdale, FL.
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good... at least I don't feel alone in my quest for putting the board stats up.

Reply With Quote
  #5  
Old 08-25-2001, 07:26 PM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, what Im working on is a little more in depth.. A bit more statistics than any others I saw so far..

My niece just led me through a half hour tirade of why that witch from little mermaid is a really horrible person so I havent even looked at the record users bit.

As far as starting your own, if you are any good you can probably do much better than I will anyway. If you do figure out the code let us all know.
Reply With Quote
  #6  
Old 08-25-2001, 11:55 PM
TheProfessor TheProfessor is offline
 
Join Date: Jan 2003
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, here it is, the statistics hack:

Create a file named stats.php. insert the following lines:

PHP Code:
<?php
// Boardstatistics scripted by Znaper (e-mail: [email]webmaster@znapers-board.de[/email])

require('./global.php');

// get total members
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=$numbersmembers['users'];

// get active members
$snonposters=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user WHERE posts=0');
$nonposters=$snonposters['users'];
$activemembers=$numbermembers-$nonposters;
$activityrate=sprintf("%.2f",(100*$activemembers/$numbermembers));

// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=$countposts['posts'];

// get total threads
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=$countthreads['threads'];

// get total thread views
$boardviews $DB_site->query_first("SELECT SUM(views) AS threadviews FROM thread");
$totalviews $boardviews[threadviews];

// get total pms
$totalpms $DB_site->query_first("SELECT count(*) as pmcount FROM privatemessage"); 
$totalpm $totalpms[pmcount];

// thanks to AA for the following lines:
// get Top 10 Posters of the last 30 days
if (isset($days)==and $days==0) { $days=30; }

$datecut=time()-($days*86400);

$posts=$DB_site->query("SELECT DISTINCT(userid),COUNT(postid) AS posts
                          FROM post
                         WHERE userid > 0 AND post.dateline>=
$datecut
                      GROUP BY userid
                      ORDER BY posts DESC
                         LIMIT 10"
);

while (
$user=$DB_site->fetch_array($posts)) {

$result=$DB_site->query_first("SELECT username
                                   FROM user
                                  WHERE userid=
$user[userid]");
                                  
$topposters.="<tr><td><a href=\"member.php?action=getinfo&userid=$user[userid]\">$result[username]</a></td><td>$user[posts]</td></tr>";
                                  }
                                  
// thanks to AA for the following lines:
// get Top 10 Posters of the last 24 hours
if (isset($days2)==and $days2==0) { $days2=1; }

$datecut2=time()-($days2*86400);

$posts2=$DB_site->query("SELECT DISTINCT(userid),COUNT(postid) AS posts
                          FROM post
                         WHERE userid > 0 AND post.dateline>=
$datecut2
                      GROUP BY userid
                      ORDER BY posts DESC
                         LIMIT 10"
);

while (
$user2=$DB_site->fetch_array($posts2)) {

$result2=$DB_site->query_first("SELECT username
                                   FROM user
                                  WHERE userid=
$user2[userid]");
                                  
$toplastposters.="<tr><td><a href=\"member.php?action=getinfo&userid=$user2[userid]\">$result2[username]</a></td><td>$user2[posts]</td></tr>";
                                  }
                                  

$co="Statistics-Hack ? 2001 by <a href=\"mailto:webmaster@znapers-board.de\">Znaper</a>, thanks to AA";
$templatesused "";
// Only one template is used so load it when called
eval("dooutput(\"".gettemplate("boardstatistics")."\");");

// free used memory
unset($user);
$DB_site->free_result($posts);
unset(
$user2);
$DB_site->free_result($posts2);

?>
Save this file the root directory of your board.

Next create a template namend boardstatistics. Insert the following lines into the template:

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<
html>
<
head>
  
<
title>$bbtitle Boardstatistics</title>
  
$headinclude
</head>
<
body>

$header
<br>

<
table cellpadding="0" cellspacing="0" border="1" width="100%" align="center">
<
tr><td bgcolor="#00496C" align="center"><font face="verdana, arial, helvetica" size="2"  color="Silver"><b>BOARDSTATISTIK</b></td></tr>
<
tr><td bgcolor="#000333">
<
normalfont>
  <
b>?</bRegistered Members: <b>$numbermembers</b><br>
  <
b>?</b0-Posters: <b>$nonposters</b><br>
  <
b>?</bActive Members: <b>$activemembers</b><br>
  <
b>?</bActive rate of all Members: <b>$activityrate %</b><br>
  <
b>?</bTotal Threads: <b>$totalthreads</bthreads<br>
  <
b>?</bTotal Posts: <b>$totalposts</bposts<br>
  <
b>?</bTotal Views: <b>$totalviews</bviews<br>
<
br>
  <
b>?</b> <b>$totalpm</b> Private Messages are stored in our Mailboxes!
<
br><br><center>
<
table><tr><td valign="top">

<
table cellpadding="2" align="center" bordercolor="#000040" border="-1">
<
tr bgcolor="#00496C"><td colspan=2 align=center><b>Top10 Poster of the last 30 days</b></td></tr>
<
tr bgcolor="#00496C"><td>Username</td><td>posts</td></tr>
$topposters</table>
</
td><td valign="top">

<
table cellpadding="2" align="center" bordercolor="#000040" border="-1">
<
tr bgcolor="#00496C"><td colspan=2 align=center><b>Top Poster of the last 24 hours</b></td></tr>
<
tr bgcolor="#00496C"><td>Username</td><td>Posts</td></tr>
$toplastposters</table>
</
td></tr></table>
<
br><br></center>
</
font></normalfont>
</
td></tr></table>

$footer
<center>$co</center>
</
body>
</
html
Now just call stats.php. Furthermore place a link in on of your templates so members can view the stats. I suggest forumhome ...

Greetings, The Professor!
Reply With Quote
  #7  
Old 08-26-2001, 05:54 AM
JamesUS's Avatar
JamesUS JamesUS is offline
 
Join Date: Oct 2001
Posts: 347
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is also another vBStats hack that does something slightly different. If you want to take a look, search for 'vbstats' in the Hacks forum.
Reply With Quote
  #8  
Old 08-26-2001, 12:52 PM
Lian
Guest
 
Posts: n/a
Default

Very nice TheProfessor,
I'll suggest to built that into our forums,
Lian
Reply With Quote
  #9  
Old 08-26-2001, 02:00 PM
TheProfessor TheProfessor is offline
 
Join Date: Jan 2003
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, but please remeber that all credits go to Znaper and AA ...
Reply With Quote
  #10  
Old 08-26-2001, 04:24 PM
Kevlar's Avatar
Kevlar Kevlar is offline
 
Join Date: Nov 2001
Location: Ft. Lauderdale, FL.
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Random users are getting this error

Warning: Cannot add header information - headers already sent by (output started at /home/bimmer/www/main.php:7) in /home/bimmer/www/forum/admin/functions.php on line 1459

Only random users. I don't get it, but other users are telling me the error exists.

any ideas?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:44 PM.


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.04619 seconds
  • Memory Usage 2,316KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete