Code: Select all
<!-- IF S_CODE_UNTIDY and S_MESS_ON_INDEX Good If_Not_TIDY_Then_SUBMIT -->
Code: Select all
add_log('admin', 'LOG_DOWNLOAD_SUCCES', $attachment['physical_filename']);
That mod doesn't keep a log of what users downloadedmartin123456 wrote:http://www.phpbb3bbcodes.com/viewtopic.php?f=57&t=2166
Now that is what i was looking for thankyou i ll try to install it later and report backmaxrpg wrote:I have a similar thing on my site that keeps a log of users that have downloaded a file(s). When a user downloads a file it logs it in the database and the admin can see a "View Log" link below the attachment in a post which displays a list of users that have downloaded that file and when they downloaded it. It only logs a user once per file so you dont end up with loads of entries for a user if they download the same file several times.
May not be exactly what you were after but it does the job lol.
https://camo.phpbb.com/1e54d9c99b5117b32e4ddbc0462515833cc526ba/687474703a2f2f6f6934362e74696e797069632e636f6d2f6662767063772e6a7067
You just have to create a new database table, do a few small file edits and upload.
http://sdrv.ms/WCqrbg
Hope you find it useful
$db->sql_freeresult($topics_result);
Code: Select all
{
$sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
FROM ' . DOWNLOADS_LOG . ' d, ' . USERS_TABLE . ' u
WHERE u.user_id = d.user_id AND file_id = '. $fileid .'
ORDER BY d.down_date DESC';
$top_result =$db->sql_query_limit($sql, 15);
while($row = $db->sql_fetchrow($top_result))
{
$template->assign_block_vars('downloaders',array(
'D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'D_TIME' => $user->format_date($row['down_date'])
));
$db->sql_freeresult($topics_result);
}
}
Code: Select all
<!-- IF S_CODE_UNTIDY and S_MESS_ON_INDEX Good If_Not_TIDY_Then_SUBMIT -->
But its only a line of code to do it. I think martin means that its possible with this example. OPs may can think about it or have it as an inspiration.Jessica wrote:That mod doesn't keep a log of what users downloadedmartin123456 wrote:http://www.phpbb3bbcodes.com/viewtopic.php?f=57&t=2166
Ok I fixed the bug and changed the download link in the original post to the fix files. I put it together quite quickly so little glitches would be expected lol nothing too serious thoughmartin123456 wrote:It works but kicks up a debug
Page: downloaders.php?file=79 File: [ROOT]/downloaders.php Line: 38 [PHP Notice] Undefined variable: topics_result
line 38$db->sql_freeresult($topics_result);
Note this is with all debugs on in he config.php
Code: Select all
{ $sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour FROM ' . DOWNLOADS_LOG . ' d, ' . USERS_TABLE . ' u WHERE u.user_id = d.user_id AND file_id = '. $fileid .' ORDER BY d.down_date DESC'; $top_result =$db->sql_query_limit($sql, 15); while($row = $db->sql_fetchrow($top_result)) { $template->assign_block_vars('downloaders',array( 'D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $user->format_date($row['down_date']) )); $db->sql_freeresult($topics_result); } }
Code: Select all
<!-- IF S_CODE_UNTIDY and S_MESS_ON_INDEX Good If_Not_TIDY_Then_SUBMIT -->
WHERE u.user_id = d.user_id AND file_id = '. $fileid .'
WHERE u.user_id = d.user_id AND d.file_id = '. (int) $fileid .'
$db->sql_freeresult($topics_result);
$db->sql_freeresult($top_result);
<a href="./downloaders.php?file={_file.U_FILE_ID}" onclick="popup(this.href, 480, 350); return false;" title="Downloads Log" >View Log</a>
$user->session_begin();