Tuesday, October 26, 2010
Temporary Links Script in PHP
Creating Links That Expire
I've always been uneasy about creating a download page with permanent links for my software products. That just makes it too easy for some individuals out there to publish the link to the page and there goes potential revenue. I used to think that my software was not that amazing that someone would actually want to steal it, but was astonished when one day I did a Google search for some titles and found links to various cracks. For the most part, all these titles are now available free from this website.
Probably the best was to protect your software and encourage sales is by using temporary download links. These are links that "expire" after a certain number of clicks or after a certain time period. These links are also known as expirable links. The true path to the downloaded file is always hidden from view so there is no way for the person downloading the file to know exactly where it is stored. Once the link expires, the user is directed to another page advising them that the link is no longer valid.
I wrote this PHP script for use on this website. The process is relatively simple, requiring the use of PHP and MYSQL. All parameters for the temporary link is kept in a MYSQL table. This is where we track how the link will expire, the current status of the link and the true download path. A unique id is created for each link or record. Instead of being directed to the download file itself. the user is provided with a link to the PHP script with the unique id. When the user clicks the link, the id is checked and if it matches and is still valid, the user is provided the desired file and the status is updated in the database.
The scripts I created will help you to create your own temporary and masked sales page links. You can use it to create deadlines on your special sales to increase impulse buys, and it can be used to distribute downloadable files.
Key features of the scripts include:
- Links can be set to expire based on number of clicks.
- Links can be set to expire based on a period of time.
- Links can be restricted to a particular ip address.
- The source of downloadable files is always hidden.
- Expired links direct user to the page of your choice.
- Temporary link can be to a page or file.
- Type of link can be set manually or determined automatically.
- Link protected by a unique, random id.