I've gotten some php coding into this previous request, but would like to ask for any guidance on continuing to get this going.
I'm mainly working in 2 files: includes/functions.php and download.php, where I believe my php coding if off. Otherwise, I have everything else set up to make this happen in other relevant files, having been guided by the Keep Track of What Each User Has Downloaded thread (
http://www.4homepages.de/forum/index.php?topic=4606.0).
My code in download.php:
After the send file function, ending with:
else {
ereg("(.+)\.(.+)", get_basefile($image_row['image_media_file']), $regs);
$file_name = $regs[1];
$file_extension = $regs[2];
$file['file_name'] = $file_name.(($size) ? "_".$size : "").".".$file_extension;
$file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
}
I inserted:
$downloaded_users = $image_row['user_id'];
$users_array = explode(" ", $downloaded_users);
if (in_array($user_id, $users_array)) {
$downloaded_users = $download_user_name;
}
if (!empty($image_row['image_downloads'])) {
$site_template->register_vars(array(
"download_user_name" => $download_user_name,
"download_date" => date("M d, Y", $download_date),
"comment_user_email_button" => $comment_user_email_button
));
$image_downloaded = $site_template->parse_template("downloaded_bit");
}
In function.php:
Inserted at very end of file before the php close tag:
function add_to_download_date($id) {
$download_date = $image_row['download_date'];
$sql = "UPDATE ".IMAGES_TABLE."
SET download_date = time()
WHERE image_id = $image_id";
return ($site_db->query($sql)) ? 1 : 0;
}
Other files/relevant changes which have seemed to be fine:
- I've set up a db row in the image table entitled "download_date"
- details.html has link to copy which is linked from a new file "downloaded_bit.html"
Thank you kindly, ready to give any other info I can, tomorrow.... need to leave for the night.