Forum Moderators: coopster
i have done all the things only this dynamic link issue is left. wise words are highl appreciated.
thanks for yout ime
1) user fills a small form with name and email
2) On Submission automatically an email with the downloading link is sent to the user on his mentioned email in the form.
3) that link would be a directly downloading link to the file e.g www.domain.com/downloads/filename.zip, so the user clicks on it and start downloading the file BUT he must not use the same link twice i mean if he tells his buddy the link and his buddy downloads the file without filling form..
here i want to create such a mechanism that use some unique value everytime and concatinate it with filename and then to place a sort of check that whether link is used once or not.
i hope it will help u to understand the process i want and if your preveious suggestion was exactly its solution then please give me some more details
thank u very much for your time
Then generate a link like this:
$url = "download.php?id=" . md5($email) . "&file=" . md5($file);
When user comes to download:
$query = "SELECT file FROM downloads WHERE md5(email) = '" . $_GET['email'] . "' AND md5(file) = '" . $_GET['file'] . "' AND used = 0";
$file = /* perform query */
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="downloaded.pdf"');
readfile($file);
Then do:
$query = "UPDATE downloads SET used = 1 WHERE md5($email) = '" . $_GET['email'] . "'";
Of course, you'll want to check your $_GET before using it carelessly like that, but it's a short example to provide the concept. The md5 isn't really needed to make it unique, it's just if you want to be really cryptic about it ;)