I have a product that I am selling and would like a dynamic download link to be shown after the purchase. The link should expire in the time that I set (1 day, 7 days...) What script do I need? Thanks!
When the purchase is made add it to the db and generate a unique key (Global Unique IDentifier - GUID would be a reasonable tool). Link to downloadpage.aspx?key= + their key. On the downloadpage request the key, and check the database. Depending on what messages you want to present to the user either simply check where key=key and purchasedate < now.adddate(-7) - if a record is found then it is valid and you pick up the file and give it as the page output. If there are no records then give a message saying it is invalid. It is probably better to actually just request the key however and ask it to return the purchase date. No record you give error message saying it is invalid. If a date is returned then do the logic check against your expiry policy and if this fails then give error message saying it has expired. Finally if the logic is true then pick up the file and give it as the response.