1. 會員名不會重複出現在下載名單
2. 下載次數只會一人加一次,就算同一人下載 10 次也只會加 1 次
3. 更方便觀看下載名單。
4. 解決前版的一些 BUG!
5. 再次加快了 SQL 速度。
ALTER TABLE `cdb_attachments` ADD `dl_users` TEXT NOT NULL ;
1. 修改 attachment.php
$db->query("UPDATE $table_attachments SET downloads=downloads+1 WHERE aid='$aid'");
# DL Users
$query2 = $db->query("SELECT dl_users FROM $table_attachments WHERE aid='$aid' AND dl_users like '%$discuz_user,%'");
if($db->result($query2, 0)) {
} else {
$db->query("UPDATE $table_attachments SET downloads=downloads+1 WHERE aid='$aid'");
$dl_user = $attach[dl_users].''.$discuz_user.', ';
$dl_user = addslashes($dl_user);
$db->query("UPDATE $table_attachments SET dl_users='$dl_user' WHERE aid='$aid'");
}# DL Users end
2. 修改 viewthread.php
a.attachment, a.filesize,
<!--{loop $postlist $post}-->
<a name="pid$post[pid]"></a>
<!--{if $showdlusers == 'yes' && $post['aaid']}-->
<fieldset><legend align="center"><strong>下 載 名 單 ( $post[downloads] )</strong></legend><center>$post[dl_users]</center></fieldset>
<!--{/if}-->
下載名單:<a href="viewthread.php?tid=$tid&page=$page&showdlusers=yes#pid$post[pid]">[ 按此觀看 ]</a>