Great news. You just helped me to get the script working. Here's the code:
Code:
$limit = 10000000;
$query = $vbulletin->db->query_first("
SELECT current_bandwidth FROM " . TABLE_PREFIX . "user
WHERE userid = " . $vbulletin->userinfo[userid]);
$add = $query['current_bandwidth'] + $attachmentinfo['filesize'];
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET current_bandwidth = $add
WHERE userid = " . $vbulletin->userinfo[userid]
);
if($add > $limit)
{ exit(); }
Working! One more thing I was wondering, if exiting the script like this, it will cache a blank attachment. So in case I up the limit a bit, it will not reload the actual attachment, but still show the blank one. I guess there's no easy way around this except for emptying the cache.
Also, currently, when the limit is crossed, it will show a blank attachment. Is it possible to use the space for a proper message telling the user that their bandwidth has exceeded the allowance?
Simply adding a print wouldn't do the trick.