PDA

View Full Version : top5.thread.stats


NanoEntity
11-05-2001, 10:00 PM
Demo: http://nekio.com/forums


// #######################################
TOP5.THREAD.STATS
// #######################################
// #
// # NanoEntity
// #
// # Top5.Thread.Stats
// # Version: 2.2.0
// # Created: 11/05/2001
// #
// #######################################
// #
// # COPYRIGHT NOTICE:
// #
// # ?Copyright 2001, HOLOLITH.COM.
// # All Rights Reserved.
// #
// # Selling the code for this script
// # without prior written consent is
// # expressly forbidden. In all cases
// # copyright and header must remain intact.
// #
// #######################################

index.php

// #######################################
Look>>
// #######################################

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

// #######################################
Before It ADD>>
// #######################################

// Top 5 Statistics BY NanoEntity
// Top 5 Posters
$posts5 = $DB_site->query('SELECT userid,username,posts FROM user ORDER BY posts DESC LIMIT 5');
while ($posts5top = mysql_fetch_array($posts5)):
++$posts5topnbsp;
$posts5name .= "? <a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$posts5top[userid]>$posts5top[username]</a><br>";
$posts5post .= "$posts5top[posts] ?<br>";

endwhile;
// Top 5 Posters
// Top 5 New Members
$user = $DB_site->query('SELECT userid,posts,username,joindate FROM user ORDER BY joindate DESC LIMIT 5');
while ($usertop = mysql_fetch_array($user)):
++$usertopnbsp;
$username .= "? <a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$usertop[userid]>$usertop[username]</a><br>";
$userposts .= "$usertop[posts] ?<br>";

endwhile;
// Top 5 New Members
// Top 5 Thread Replys
$pop = $DB_site->query('SELECT title,threadid,lastpost,lastposter,views FROM thread ORDER BY lastpost DESC LIMIT 5');
while ($poptop = mysql_fetch_array($pop)):
++$poptopnbsp;
$popthread .= "? <a href=showthread.php?s=$session[sessionhash]&threadid=$poptop[threadid]>$poptop[title]</a><br>";
$poplastposter .= "$poptop[lastposter]<br>";
$popviews .= "$poptop[views] ?<br>";

endwhile;
// Top 5 Thread Replys
// Top 1 Most Popular Thread
$pop1 = $DB_site->query('SELECT title,threadid,views FROM thread ORDER BY views DESC LIMIT 1');
while ($pop1top = mysql_fetch_array($pop1)):
++$pop1topnbsp;
$pop1title .= "<a href=showthread.php?s=$session[sessionhash]&threadid=$pop1top[threadid]>$pop1top[title]</a>";
$pop1views .= "$pop1top[views]";

endwhile;
// Top 1 Most Popular Thread
// Top 1 Most Rated Thread
$rated = $DB_site->query('SELECT title,threadid,votenum FROM thread ORDER BY votenum DESC LIMIT 1');
while ($ratedtop = mysql_fetch_array($rated)):
++$ratedtopnbsp;
$ratedtitle .= "<a href=showthread.php?s=$session[sessionhash]&threadid=$ratedtop[threadid]>$ratedtop[title]</a>";
$ratedrating .= "$ratedtop[votenum]";

endwhile;
// Top 1 Most Rated Thread
eval("\$top5threadstats = \"".gettemplate("hl_statistics")."\";");
// Top 5 Statistics BY NanoEntity

// #######################################

# Add template: hl_statistics

// #######################################
Add>>
// #######################################

<!-- key NanoEntity hololith.com -->
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#000000" width="100%" align="center">
<tr>
<td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td bgcolor="#006633" colspan="3">
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<td bgcolor="#006633">
<B><normalfont>Statistics</normalfont></B></td>
</tr>
</table>
</td>
</tr>
<tr>
<TD bgcolor="#DFDFDF" width="25%">
<smallfont>

<b>Top 5 Posters:</b>
<hr>

<table>
<tr>
<td width=100%><smallfont>User Names:</smallfont></td>
<td align="right"><smallfont>Posts:</smallfont></td>
</tr>
<tr>
<td width=100%><smallfont><b>$posts5name</b></smallfont></td>
<td align="right"><smallfont><b>$posts5post</b></smallfont></td>
</tr>
</table>

</smallfont></td>

<TD bgcolor="#F1F1F1" width="25%">
<smallfont>

<b>Top 5 Newest Members:</b>
<hr>

<table>
<tr>
<td width=100%><smallfont>User Names:</smallfont></td>
<td align="right"><smallfont>Posts:</smallfont></td>
</tr>
<tr>
<td width=100%><smallfont><b>$username</b></smallfont></td>
<td align="right"><smallfont><b>$userposts</b></smallfont></td>
</tr>
</table>

</smallfont></td>

<TD bgcolor="#DFDFDF" width="50%">
<smallfont>
<b>Top 5 New Thread Replys:</b>
<hr>

<table>
<tr>
<td width=75%><smallfont>Thread Names:</smallfont></td>
<td width=25%><smallfont>Last Posters:</smallfont></td>
<td align="right"><smallfont>Views:</smallfont></td>
</tr>
<tr>
<td width=75%><smallfont><b>$popthread</b></smallfont></td>
<td width=25%><smallfont><b>$poplastposter</b></smallfont></td>
<td align="right"><smallfont><b>$popviews</b></smallfont></td>
</tr>
</table>
</smallfont></td>
</tr>
<tr>
<td bgcolor="#005628" colspan="3">
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<td bgcolor="#005628">
<smallfont>
Popular thread is <b>$pop1title</b> | <b>$pop1views</b> views. </smallfont></td>


<td bgcolor="#005628" align="right">
<smallfont>
Rated thread is <b>$ratedtitle</b> | <b>$ratedrating</b> votes.
</smallfont></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- / key NanoEntity hololith.com -->

// #######################################

# In template: forumhome:

// #######################################
Add where ever you like>>
// #######################################

$top5threadstats

// #######################################
N O T E
// #######################################

$pop = $DB_site->query("SELECT title,threadid,lastpost,lastposter,views FROM
thread WHERE forumid<>'X' AND forumid<>'Y' AND forumid<>'Z' ORDER BY
lastpost DESC LIMIT 5");

Just replace x, y and z with the forums you want to exclude,
this was not implemented becouse I didn't had time.

I am working on a better version, and with mysql CP (options) support for admin,
+ something else, (none public release), but this version is, so enjoy.
- NanoEntity (hololith.com)

// #######################################

Neo
11-06-2001, 03:53 AM
heres what i did from a upgrade from your code.

Features:
-Different bar for members and visitors
-Admins avatar plus welcome message for logged out users on stats bar
-log in feature in visitors stats bar
-hide unwanted information from certain forums
-code updated

http://www.animeutopia.com/unreg.gif
logged in
http://www.animeutopia.com/reg.gif

fonzerelli_79
11-06-2001, 01:57 PM
fantastic hack

works very well and easy to install

keep up the good work

Scott MacVicar
11-06-2001, 02:11 PM
you should post this in a text file, it kinda defeats the purpose of stopping unliscenced members download files when you just show them it in the thread ;)

fonzerelli_79
11-06-2001, 02:21 PM
PPN

(im registered by the way)

:p

TheComputerGuy
11-07-2001, 12:21 AM
like this isnt his Hack...

Prince
11-08-2001, 09:54 PM
Is this a bug?

Look at this screen shot, one of the threads is dispayed with "no views", when in fact is about 45 views.

almightyone
11-08-2001, 11:51 PM
its not really shwing it with no views i do believe this is some one elses hack that was distributed earlier by another user who offered to share it and we all together resovled the problem search in requests for top5 stats or stats you will find the thread started by sarge and in the thread it tells to fix it and how

Prince
11-09-2001, 01:16 AM
Originally posted by almightyone
its not really shwing it with no views i do believe this is some one elses hack that was distributed earlier by another user who offered to share it and we all together resovled the problem search in requests for top5 stats or stats you will find the thread started by sarge and in the thread it tells to fix it and how

I fixed it.

I just had to tweak the HTML in the template. :)

fonzerelli_79
11-12-2001, 11:27 PM
how would i put the stats on a separate page and link to it just like the view new posts link on the home page

squawell
11-13-2001, 01:17 AM
thanks NanoEntity!!:D

it's a great hack ~~

Sweet Evil
11-13-2001, 07:39 AM
Originally posted by TheComputerGuy
like this isnt his Hack...


I agree, I got this long ago and it was not done by him... :mad:

wolfe
06-27-2002, 05:18 PM
is there anyway of making it so it don't show posts from certain forum like posts in the Admin forum etc so others can see titles of posts from certain forums :D

Chris M
06-27-2002, 08:19 PM
Add some sql queries to the code to exclude certain forums...

Satan

almightyone
06-27-2002, 09:26 PM
yeah ill help ya a bit further then sayong run some queries
goto the index php
find the first
// Top 5 Thread Replys

then look where it says $pop
mske the line look this way
$pop = $DB_site->query('SELECT title,threadid,lastpost,lastposter,views FROM thread WHERE forumid<>='XX' AND forumid<>='X' AND forumid<>='XX'ORDER BY lastpost DESC LIMIT 5');

simply remove the extras if you only need one or add more if desired

SHoeSTeR
07-16-2002, 09:22 PM
I get this error:
Fatal error: Call to undefined function: phperror_reporting() in /home/mtgshoe/public_html/forums/index.php on line 1

i'm using version 2.2.5

lifesourcerec
07-24-2002, 03:10 AM
What would the sql query be to exclude only 1 forum?

lifesourcerec
07-24-2002, 03:19 AM
Originally posted by almightyone
yeah ill help ya a bit further then sayong run some queries
goto the index php
find the first
// Top 5 Thread Replys

then look where it says $pop
mske the line look this way
$pop = $DB_site->query('SELECT title,threadid,lastpost,lastposter,views FROM thread WHERE forumid<>='XX' AND forumid<>='X' AND forumid<>='XX'ORDER BY lastpost DESC LIMIT 5');

simply remove the extras if you only need one or add more if desired

is it forumid<>'(forum id number) or do you need a "=" between <> and '(forum id number)'?

countryboy713
07-24-2002, 04:33 AM
Here's a minor adjustment that a friend did up for me.

Its to cut off the last 5 replies if Theyre too long for your setup.
(I have a thin welcome panel and long thread titles wrap around and look like crap)




// Top 5 Thread Replys
$pop = $DB_site->query('SELECT title,threadid,lastpost,lastposter,views FROM thread ORDER BY lastpost DESC LIMIT 5');
while ($poptop = mysql_fetch_array($pop)):
++$poptopnbsp;

$thelength=25;
$thetitle=$poptop[title];
if(strlen($poptop[title]) > $thelength) {
$thetitle=substr($poptop[title], 0, $thelength)."...";
}




$popthread .= "? <a href=showthread.php?s=$session[sessionhash]&threadid=$poptop[threadid] title=\"$poptop[title]\">$thetitle</a><br>";
$poplastposter .= "$poptop[lastposter]<br>";
$popviews .= "$poptop[views] ?<br>";

endwhile;
// Top 5 Thread Replys


$thelength= being the number of characters you want to show. This also shows the full title when a user hovers over the thread title.


Im not sure what's different since I didnt do it, so just copy that over your current code starting with the //Top5 replys and ending with it too.


Oh, this is in the index.php in case you didnt know lol.

lifesourcerec
07-30-2002, 04:20 PM
Originally posted by almightyone
yeah ill help ya a bit further then sayong run some queries
goto the index php
find the first
// Top 5 Thread Replys

then look where it says $pop
mske the line look this way
$pop = $DB_site->query('SELECT title,threadid,lastpost,lastposter,views FROM thread WHERE forumid<>='XX' AND forumid<>='X' AND forumid<>='XX'ORDER BY lastpost DESC LIMIT 5');

simply remove the extras if you only need one or add more if desired

When doing that I get:


Parse error: parse error, unexpected T_LNUMBER

wolfe
09-05-2002, 03:04 PM
is there a way of stoping it showing thread/posts in provate forums to groups that can not access them

i want to stop normal member from seeing posts in Admin forum please help me :D

Prince
09-05-2002, 06:42 PM
you can prevent forums from displaying, but it's either on or off, not dependant on their user group.

wolfe
09-05-2002, 09:30 PM
well how can i stop forums from showing :D

LOD-squa
09-08-2002, 03:47 AM
I need help on that also.

Tony DiMera
09-08-2002, 06:28 PM
I love it, it is a great hack thanks.

CrazyPig
09-09-2002, 01:37 PM
I have question i want to add another table to the stats and i want to be shown there number of posts from certain forum like the number of posts that user have but only from the certain forum. how can i do that?

LOD-squa
09-12-2002, 11:13 PM
I have a question how can I exclude private forums? Like only mods,admin,smod can see it.

Dark Shogun
09-12-2002, 11:13 PM
I can't find something in the admin/index.php :( Thats the problem for the
most part.


Dark Shogun

Neo
09-12-2002, 11:32 PM
I hate to tell you guys but I killed Nano a little but ago...... *points to his profile* Thanks to the help of Nano I kind of update this and included the piece to exclude certain forum :)

LOD-squa
09-22-2002, 02:14 AM
so for more than 1 forum do I need to make it 1,5 or is it something else?

LOD-squa
09-22-2002, 02:16 AM
[QUOTE]Originally posted by Dark Shogun
I can't find something in the admin/index.php :( Thats the problem for the
most part.


Dark Shogun

LOD-squa
09-24-2002, 12:18 AM
could anyone tell me?

Kinox
09-28-2002, 02:07 AM
Sorry this hack is unsupported by me anymore, there is an updated version of it, but its private.

Demo at http://forums.gfxart.net

wolfe
10-11-2002, 12:18 PM
with this code do u have to add all the forums you want to show or all the ones you don't :D

$pop = $DB_site->query('SELECT title,threadid,lastpost,lastposter,views FROM thread WHERE forumid='XX' AND forumid='X' AND forumid='XX'ORDER BY lastpost DESC LIMIT 10');

a43079
10-11-2002, 09:18 PM
nice hack

LOD-squa
11-23-2002, 06:20 PM
okay I got the topics hidded from hidded forums but is there a way I can make it to show it to the people that have access to the forum?

Kinox
01-06-2003, 01:04 AM
Exclude users + forums

so it looks something like this

$pop = $DB_site->query('SELECT title,threadid,lastpost,lastposter,views,user.user name FROM thread WHERE forumid NOT IN(1,56,83,13), usergroupid NOT IN(8,4,3,1)
LEFT JOIN user
ON (user.username=thread.lastposter)
ORDER BY lastpost DESC LIMIT 10');

8 = Banned by Moderators
4 = (COPPA) Users Awaiting Moderation
3 = Users Awaiting Email Confirmation
1 = Unregistered / Not Logged In

Enjoy.