wickedlad_ii 寫:谢谢心靈捕手,积分限制附件查看的功能终于解决了。
我預設每位註冊會員都有 33 積分,是因为不想用户一开始就为积分发愁,因为一般的书籍网路上有的是下载的地方,我主要是想凭一些独家的资源与特色留住用户。
现在很要紧的是能实现下載附件扣分的功能,如果方便的话清继续指教。
'下載扣分' 的方法, 尚未參透.
不過, 與您[分享]
若 [上傳/刪除] 附加檔案, 則 [獲得/扣除] 現金的方法.
#
#-----[ OPEN ]-----
#
attach_mod/posting_attachments.php
#
#-----[ FIND ]-----
#
代碼: 選擇全部
// Ok, upload the Attachment
if (!$error)
{
$this->move_uploaded_attachment($upload_mode, $file);
}
#
#-----[ REPLACE WITH ]-----
#
ps. 請自行修改貨幣欄位值
代碼: 選擇全部
// Ok, upload the Attachment
if (!$error)
{
$this->move_uploaded_attachment($upload_mode, $file);
// 若上傳一個檔案, 則獲得現金 100
$sql = "UPDATE phpbb_users SET user_money = user_money+100 WHERE user_id = ".$userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_MESSAGE, "<b>Fatal Error!</b><br><br>".mysql_error());
}
}
#
#-----[ OPEN ]-----
#
attach_mod/includes/functions_delete.php
#
#-----[ FIND ]-----
#
代碼: 選擇全部
function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, $user_id = 0)
{
global $db;
#
#-----[ REPLACE WITH ]-----
#
代碼: 選擇全部
function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, $user_id = 0)
{
global $db, $userdata;
#
#-----[ FIND ]-----
#
代碼: 選擇全部
$sql = 'DELETE FROM ' . ATTACHMENTS_DESC_TABLE . '
WHERE attach_id = ' . (int) $attachments[$j]['attach_id'];
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['Error_deleted_attachments'], '', __LINE__, __FILE__, $sql);
}
#
#-----[ REPLACE WITH ]-----
#
ps. 請自行修改貨幣欄位值
代碼: 選擇全部
$sql = 'DELETE FROM ' . ATTACHMENTS_DESC_TABLE . '
WHERE attach_id = ' . (int) $attachments[$j]['attach_id'];
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['Error_deleted_attachments'], '', __LINE__, __FILE__, $sql);
}
// 若刪除一個檔案, 則扣除現金 200; 系統 (版面) 管理員除外
if ( $userdata['user_level'] == 0 )
{
$sql = "UPDATE phpbb_users SET user_money = user_money-200 WHERE user_id = ".$userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_MESSAGE, "<b>Fatal Error!</b><br><br>".mysql_error());
}
}
另外, 進入控制台 -> 貨幣控制台 (Cash Admin) -> 基本設置 -> 會員賺取金額時顯示的訊息:
#
#-----[ FIND ]-----
#
代碼: 選擇全部
You earned %s for that post
#
#-----[ REPLACE WITH ]-----
#
ps. 請自行修改貨幣欄位值
代碼: 選擇全部
You earned %s for that post<br>若上傳一個檔案, 則獲得現金 100<br>若刪除一個檔案, 則扣除現金 200; 系統 (版面) 管理員除外
#
#-----[ SAVE & CLOSE ]-----
#
DEMO:
http://wang5555.dnsfor.me/test/phpbb2/index.php