I have an album of songs that I want to store on my website and I want a person to enter first name, last name, and email in order to get a link to download the zip file of mp3s. I want to send them an email to a link that will allow the user to download the file and also count the number of times the link has been accessed (number of times file was downloaded).
I want to have a web form that has a user enter first name, last name and email. I know how to do that part. I also can set up a simple mysql database.
How do you think I can set up the link the email to the download file? Should I create a randomized link? How would I go about doing that?
Or should I send the email containing a link with the first and last name of the person (using GET to pass information), then it checks the database if the first and last name exists, then write out a page with a link to the download file?
Anyway, any recommendations or things to consider would be MUCH appreciated.
Creating a link to download a file
Moderator: General Moderators
-
greenlimosine
- Forum Newbie
- Posts: 2
- Joined: Sat Mar 26, 2011 11:11 pm
-
dgreenhouse
- Forum Newbie
- Posts: 20
- Joined: Tue Mar 10, 2009 5:13 am
Re: Creating a link to download a file
Randomized would be best and only valid once... maybe?
Maybe something like:
Maybe something like:
Code: Select all
$rand = md5(uniqid(mt_rand(), true));
// Save the $rand for later
// Create a link for the download
echo '<a href="getfile.php?tk='.$rand.'">Download</a>';
-
greenlimosine
- Forum Newbie
- Posts: 2
- Joined: Sat Mar 26, 2011 11:11 pm
Re: Creating a link to download a file
Awesome! thanks so much. I'll try it out!