name = "Download xxx File";
$this->desc = "Download a file [INSERT FILE DESCRIPTION HERE]";
$this->price = 200;
$this->require_input = false;
$this->can_use_item = true;
}
//see AddToPostCount for more info
function getAddInput() {
return "File Name:
This file name does NOT need to be the same name as the file on the server. This name
is what the file will be saved as on the user's computer.
File Path (INCLUDING FILE NAME): IMPORTANT: Make SURE that this file path is OUT of your webroot. If your forum is
stored at /home/myuser/public_html/forum/ then store the downloadable file at
/home/myuser/files/ or similar. Otherwise, you run the risk of the file being
downloaded without being paid for.
Delete item from inventory after use";
}
function onUse() {
global $item_info, $db_prefix;
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename={$item_info[1]}");
readfile($item_info[2]);
if (isset($item_info[3]) && $item_info[3] == "on") {
$result = db_query("DELETE FROM {$db_prefix}shop_inventory
WHERE id = {$_GET['id']}",
__FILE__, __LINE__);
}
exit();
}
}
?>