View Full Version : Show Thread Enhancements - Upload/Download Stats in Postbit
tnguy3n
01-13-2005, 10:00 PM
Upload/Download & Total Upload/Download stats
Requested here (https://vborg.vbsupport.ru/showthread.php?t=73124)
Modded by tnguy3n (Thinh Nguyen)
Live Demo: http://www.all4actions.net
Description: This mod display total filesize and number of upload/download in postbit.
I've tested it in vb3.0.1, 3.0.3 and 3.0.5.
New queries: 1
File Mod: 3
Template mod: 3
Installation Time: 4-5 mins
Note: make sure to run the query in phpMyAdmin or it will get an error. :rolleyes:
Please click "INSTALL" if you use the hack. :nervous:
lasto
01-14-2005, 01:26 AM
clicked install m8 - all seems fine except for me it wont reg if someone downloads
the stats only update when they upload.Downloads stay at Zero regardless
will see if anyone else has same problems
tnguy3n
01-14-2005, 02:00 AM
clicked install m8 - all seems fine except for me it wont reg if someone downloads
the stats only update when they upload.Downloads stay at Zero regardless
will see if anyone else has same problems
okie, got that fixed now. :)
*update one instruction*
To fix your current download stats problem, open attachment.php,
FIND:
// update user download stats by tnguy3n
$filesize = $attachmentinfo['filesize']/1024;
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "user
SET downloadno = downloadno + 1
WHERE userid = $bbuserinfo[userid]
");
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "user
SET downloadtotal = downloadtotal + $filesize
WHERE userid = $bbuserinfo[userid]
");
Then DELETE IT!
FIND:
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "attachmentviews (attachmentid)
VALUES ($attachmentinfo[attachmentid])
");
}
BELOW IT, ADD:
// update user download stats by tnguy3n
$filesize = $attachmentinfo['filesize']/1024;
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "user
SET downloadno = downloadno + 1
WHERE userid = $bbuserinfo[userid]
");
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "user
SET downloadtotal = downloadtotal + $filesize
WHERE userid = $bbuserinfo[userid]
");
That's it! and it based on code of vb 3.0.5.
lasto
01-14-2005, 02:23 AM
works perfect now m8 :)
File Download: 2 - Total Download: 6120 KB
one slight problem but this deffo may be me
if i upload a file and a preview pic - it adds 3 to the count whereas the attachemnts should add 2 only.Noticed this after i did a few uploads of small pic rars.
lasto
01-14-2005, 02:36 AM
Deffo an Error on counting up the uploaded stats - here goes
ok before i upload here is my stats
File Upload: 5 - Total Upload: 737 KB
File Download: 2 - Total Download: 6120 KB
Now i just uploaded a preview pic which was 160K and a test rar which was 5.10 meg
Now check out the stats afterwards ...................
File Upload: 8 - Total Upload: 901 KB
File Download: 2 - Total Download: 6120 KB
deffo adding an extra one somewhere and not totaling up correct
tnguy3n
01-14-2005, 02:44 AM
Deffo an Error on counting up the uploaded stats - here goes
ok before i upload here is my stats
File Upload: 5 - Total Upload: 737 KB
File Download: 2 - Total Download: 6120 KB
Now i just uploaded a preview pic which was 160K and a test rar which was 5.10 meg
Now check out the stats afterwards ...................
File Upload: 8 - Total Upload: 901 KB
File Download: 2 - Total Download: 6120 KB
deffo adding an extra one somewhere and not totaling up correct
you can upload a file 5.10 MB on your server? That amazed me. Usually, ppl ai'nt set uploaded filesize > 2 MB. but if your rar file is 5.10 KB, the upload stats seems working correctly. 737 KB + 160 KB + 5.1 KB ~ 902 KB
lasto
01-14-2005, 03:00 AM
dont figure - as 5.10 meg is not 5.10 kb
maybe its classing them as KB when there cleary not.
the total above in your thread is 902kb which is well below 1 meg yet in the downloads stats its doing em right - 2 files which make up 6 megs
also yep can upload files to a mx of 8 megs as set the max_upload to it.
Ok look at this :
Stats before :File Upload: 8 - Total Upload: 901 KB
Now im just about to upload a rar which is 1.35 MB
File Upload: 9 - Total Upload: 902 KB
so looking at that i think ive solved the problem its only counting the first attachement which in most cases is small preview pics of maps but this time i uploaded the rar without a pic and it never counted it at all
ChrisSy
01-14-2005, 09:28 AM
does this hack also back date itself? Or do the stat counter only start from when you install this hack?
lasto
01-14-2005, 09:58 AM
does this hack also back date itself? Or do the stat counter only start from when you install this hack?
from when counter starts - well is for me anyway :)
ChrisSy
01-14-2005, 11:07 AM
from when counter starts - well is for me anyway :)
you installed and works fine?
lasto
01-14-2005, 05:07 PM
you installed and works fine?
Well downloads works but for me im having problems still as its counting up 3 for every 2 files i upload + the KB aint matching up.
So far ive uploaded 28 small rar files but it thinks ive upped 56
Download bit seems fine by what i can tell.
kudos
01-14-2005, 09:04 PM
I'm having a bit of a problem, don't know if anyone can help? I can't semm to get it to work at all as I recieve the error message below when running the first query...
"An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'myforumsname.user' doesn't exist"
Any help would be appreciated:)
Lethal
01-15-2005, 08:45 AM
nice forums u have there
tnguy3n
01-15-2005, 07:58 PM
sorry guys, my mysql server on localhost ain't let me upload files bigger than 600 KB (get error says localhost server has been gone for any big file :rolleyes: ) and I can't test those big uploaded files now. I'll check with my *nix server and fix that upload stats problem. :)
lasto
01-15-2005, 11:03 PM
sorry guys, my mysql server on localhost ain't let me upload files bigger than 600 KB (get error says localhost server has been gone for any big file :rolleyes: ) and I can't test those big uploaded files now. I'll check with my *nix server and fix that upload stats problem. :)
cheers m8
Joe Pimms
02-16-2005, 04:29 AM
hey nice hack i did a little moding and i made one for the memberslist area aswell the only problem im having is the data base hope u can help here is the template code for the memberslist display.
Edit MEMBERLIST, look for this :
<if condition="$show['emailcol']"><td class="thead" nowrap="nowrap">$vbphrase[contact]</td></if>
and replace with :
<td class="thead">File Upload</td>
<td class="thead">Total Uploaded in (KB)</td>
<td class="thead">File Download</td>
<td class="thead">Total Download in (KB)</td>
<if condition="$show['emailcol']"><td class="thead" nowrap="nowrap">$vbphrase[contact]</td></if>
then:
Edit memberlist_resultsbit, look for this :
<td class="alt1Active" align="$stylevar[left]" id="u$userinfo[userid]">
<a href="member.php?$session[sessionurl]u=$userinfo[userid]">$userinfo[musername]</a>
<if condition="$show['usertitlecol']"><div class="smallfont">$userinfo[usertitle]</div></if>
</td>
and replace with :
<td class="alt1Active" align="$stylevar[left]" id="u$userinfo[userid]">
<a href="member.php?$session[sessionurl]u=$userinfo[userid]">$userinfo[musername]</a>
<if condition="$show['usertitlecol']"><div class="smallfont">$userinfo[usertitle]</div></if>
</td>
<td class="$bgclass">$numupload</td>
<td class="$bgclass">$uploadtotal</td>
<td class="$bgclass">$numdownload</td>
<td class="$bgclass">$totaltotal</td>
if u can come up with the code to work in memberlist.php that would be awsome, im useing this one here:
$getuserstats = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $post[userid]");
while ($userstats = $DB_site->fetch_array($getuserstats)) {
$numupload = $userstats['uploadno'];
$uploadtotal = $userstats['uploadtotal'];
$numdownload = $userstats['downloadno'];
$totaltotal = $userstats['downloadtotal'];
}
when i use the top code i get this error:
Database error in vBulletin 3.0.6:
Invalid SQL: SELECT * FROM user WHERE userid =
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
well i hope u can help plus can this hack use MB and not KB ?
tnguy3n
02-17-2005, 04:30 AM
sorry, i haven't had time to fix the bug in upload stats yet. I'll look into it later this weekend, hopefully, as to release new updated version of the hack. :sleep:
for your query, use this following instead:
$getuserstats = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $userinfo[userid]");
while ($userstats = $DB_site->fetch_array($getuserstats)) {
$numupload = $userstats['uploadno'];
$uploadtotal = $userstats['uploadtotal'];
$numdownload = $userstats['downloadno'];
$totaltotal = $userstats['downloadtotal'];
}
Joe Pimms
02-17-2005, 04:46 AM
sweet bro it worked with my code and your database connection worked nice
i was hoping insted of useing KB cant you use MB ?
all people need to do is edit memberlist.php and look for
// format posts number
$post['posts'] = vb_number_format($post['posts']);
and put under:
$getuserstats = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $userinfo[userid]");
while ($userstats = $DB_site->fetch_array($getuserstats)) {
$numupload = $userstats['uploadno'];
$uploadtotal = $userstats['uploadtotal'];
$numdownload = $userstats['downloadno'];
$totaltotal = $userstats['downloadtotal'];
}
thats it for the hole hack
dos this hack show Total download/uploads from the start of the counter of from the begining of the forum ?
Joe Pimms
02-21-2005, 10:08 PM
yes but it is a little buggie tho
yes what ? From the begining or from the start of the counter ? :D
Twigz
03-23-2005, 11:51 PM
yes what ? From the begining or from the start of the counter ? :D
I just installed this hack and have it working great so far.. to answer your ? PET, the Counter starts after the hack is installed.. TY
*clicks install*
PixelFx
04-17-2005, 05:35 PM
is there a way to get it so it shows all past downloads and uploads?
eXtremeTim
04-21-2005, 02:22 AM
I might look at this one later.
DeadGaze
05-01-2005, 01:03 PM
hmm is the upload stats already fixed
ore someone can do that
thanxs
ShaDooM
06-25-2005, 10:42 AM
naaahh pls fix it :<
bigdog829
07-27-2005, 03:21 AM
Is there a query we could run to update from prior to install ?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.