Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
How to create Dynamic Download Link with PHP?
I am trying to protect my ebooks. How can I make a link that changes or is unique to each user?
I want only the people that pay for the ebook to get it. Thanks
4 Answers
- 9 years agoFavorite Answer
Do not paste download link directly, insteaddo as following:
After receiving payment
Create a simple link that lead to downloadfile.php
in download file.php
check for cookie to validate a user
if cookie is found(user validated) then throw content of file as downloadable content using headers as following:
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
flush();
readfile($file);
exit;
hope that helps:
- 9 years ago
store the path to the file in a database, along with a unique identifier and a timestamp of expiry. Then when a user accesses a link with the unique ID in the get variables, check the timestamp and fetch the file/display an error accordingly.
- Anonymous5 years ago
Really, this is not something that can be answered in the context of a Yahoo Answers Space. But your best bet is using a CMS (content managment system). I would take a look at something like drupal. Drupal has tons of tutorials on their website, and you might find a drupal module that does what you want. You are going to be looking at putting at least a couple weeks into getting familiar with servers, the terminology, and the CMS.
- 7 years ago
you can try this script Simple PHP and Jquery file download script