PDA

View Full Version : Attachment Statistics


ericgtr
12-21-2004, 10:00 PM
This modification will add a new collapsable box thingie just below your forum stats. Great if your site focuses on attachments. Most of this was by request here https://vborg.vbsupport.ru/showthread.php?t=73023

Please backup your database before installing.


Includes:
Total files on the server
Space used by Attachments
Total Downoads
Total Downloaded Today

2 Files to edit: vbroot/index.php, vbtroot/attachment.php
1 Queries: (pulled from cache)
1 Templates to edit: FORUMHOME

Update: The query for Total Downloads Today was not functioning correctly so I had to update it. If you've installed this already, go into your phpmyadmin and remove the timestamp table from attachmentviews then re-edit your attachments.php and add the updated query according to the updated readme.txt

I had this moved to beta as I am still working on the query, keep in mind that I may have to change this again. If you want to help test though, that's great.

See attached file, please click install if you find it useful :)

lasto
12-22-2004, 12:45 AM
cheers m8 seen it to late so will install 2morow and report back.
Thanks for all your help on this as well m8

N8
12-22-2004, 01:55 AM
great hack

*installs*

ChrisSy
12-22-2004, 02:34 PM
thanks for this *install*

dndog
12-22-2004, 03:03 PM
Simple and useful.

* dndog clicks install. :)

PcFreak
12-22-2004, 08:43 PM
If you want to show the traffic, too.
Use this query:

//Traffic
$transfer = $DB_site->query("
SELECT SUM( counter * filesize )
FROM " . TABLE_PREFIX . "attachment
");
$transferall = @substr($transfer / 1048576, 0, 3);

The var $transferall show you all traffic (download traffic) for the attachments in the database in MB:

PcFreak

ericgtr
12-22-2004, 09:17 PM
Thanks! Great addition :)

Anyway I can use that same formatting to get this query to pull the last 24 hours correctly? This is currently not working right, the timestamp is a table I added to the attachmentviews.


//Total Downloads Today
$total_today = $DB_site->query_first('
SELECT COUNT(*) AS count
FROM ' . TABLE_PREFIX . 'attachmentviews
WHERE timestamp >= "' . strtotime("-1day") . '"
');
$total_today = number_format($total_today['count']);
//Total Downloads today

Snatch
01-18-2005, 09:23 PM
The hack do not count the downloads tody. Why this ?