Print

 

Tuesday, October 26, 2020

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.

Temporary Links Demo

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.

The scripts are available for purchase only. Other than the demo above, there is no trial available. Cost of the scripts is ONLY $14.95 USD.


 

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...

we are listening

kidmoses said:

Thursday, December 15, 2020

The real path is only shown IN SOME BROWSERS (namely IE). Unless the user is a hacker, the location of the source file will not be noticed. Assume that you only provide the temp link after someone has paid for the file, the fact that the location of the file is possibly visible to a hacker is of little concern. He has the file and can put it anywhere he wants.You can't stop people from doing bad things if they want to. That being said, I have improved the script to allow downloads from a protected directory and use a .htaccess file to prevent direct download, even if the location is visible in IE.

Chad said:

Sunday, December 11, 2020

"this script not hideing the real path i can see the real path for the demo file http://www.kidmoses.com/main/demo/templinks/demo.zip" - jame Thanks for pointing this out jame! I was interested in purchasing this script until you pointed this out. "One could create a slightly more elaborate scheme and move the file to a temporary directory before it is downloaded and then delete the file after the download." - kidmoses kidmoses, your script has a huge loophole. I was looking for a script that would do just what you mentioned and that is to copy the file from a location not in the webroot directory to a new temporary "public" directory then delete once it has "expired." To make it even better and reserve storage space on a person's site, it would be even better if when the unique link is clicked, copy the file to the temporary directory and delete it after ~5mins if download hasn't started or if download was successful then delete. This would stop multiple copies of the same file from filling up your storage space on the site. For example if someone ordered something but never downloaded it, you could potentially have multiple copies of the same file sitting on your site for months, years, etc. Seems like a rare thing I know but you never know. It would also allow you to distribute a centralized file versus managing many different copies. Or another option and possibly easier one is to store all files in your database as a BLOB type and stream the download from the database - I like this method personally but I know there are the file server crowds that are not fans of this method. Just my thoughts. Add these features and I would pay a lot more than $14.95. I would pay up to $30-40 for something that had these features. However, since it doesn't have it now, I've got to go look somewhere else or build it myself.

kidmoses said:

Monday, August 8, 2021

To prevent another link being created by simply refreshing the page, you can create the links either manually and present the link to the user if there is a small user group, or create the links dynamically in a separate script and present the link to the user in such a way that the link cannot (would not) be requested again, ie: they have to pay before the link is created.If a user can request a link for free, there is nothing to stop them from going back in and making another request.

anonymous said:

Monday, August 8, 2021

I'm trying to create links that expire per user. I am not selling the products. I bought your script and want to set it up to download zip files with limits per client/user/computer. How can I accomplish that. Your index file displays that but you can still refresh the page and continue to download the files.

kidmoses said:

Monday, August 8, 2021

The automated script is for the programmer to assist in creating the links. Look at the script to see how to create links in your own scripts. It's a great educational tool.

anonymous said:

Monday, August 8, 2021

Is the automated script made for clicks per user?

kidmoses said:

Thursday, June 30, 2021

Whether or not you can see the path to the actual file as it is being downloaded depends on the browser you are using, The average user will not notice the path to the file as displayed in IE's download dialog. And the link still expires. Once it expires, the path to the original file is unknown.

One could create a slightly more elaborate scheme and move the file to a temporary directory before it is downloaded and then delete the file after the download.

jame said:

Thursday, June 30, 2021

this script not hideing the real path i can see the real path for the demo file http://www.kidmoses.com/main/demo/templinks/demo.zip

Gary H said:

Friday, June 3, 2021

This software might also be a good way to get more attention to a published link. that is very long to type in. For example, if I wrote a letter to the editor of a newspaper and could give a very simple link to a Google Document that already has a public web address (albeit a very long one) people might take there newspaper to their computer and type in the simple temporary link. The question is, how simple can your new link be?

anonymous said:

Sunday, March 13, 2021

are these scripts something I can use with iWeb webdesigns?

kidmoses said:

Wednesday, January 19, 2021

There are many ways the script can be implemented, all depending on what you want to do exactly. Implementation is easy if you have some basic knowledge of HTML and PHP. Just follow the example in the “index.php” file included in the package.

First, you need to build a table called “links” in your MySQL database. There is a links.sql file included to make this easy. Just import it into your database.

There are three files you need to install somewhere on your website: download.php, expired.php and config.php. You will need to change the config.php to point to your MySQL database. You don’t need to change anything with the download.php. This file does all the work of determining if the link has expired. If it has expired, the user is directed to the expired.php script. If the like is not expired, the file is downloaded to the user.

You can change the text in the expired.php script to whatever you would like to say to the user.

To create the links on-the-fly just follow the example in the index.php script and present the user with the created link. If you don’t know how to program in PHP, you can use the buildlink.php script (just upload the script to your website) and use this script to create the link manually. You can then use this link, for example, in an email.

Hope this helps.

anonymous said:

Tuesday, January 18, 2021

Hi - just purchased the script. Is there an installation instruction? I'm not a programmer at all. Thanks

kidmoses said:

Wednesday, December 1, 2020

I am not familiar with Fileserve.com, but suspect you can set it up to use links on that site.

You can follow the example included in the script to see how to build the links. It's very simple. I have also included a simple form to help creating links quickly. You still need to get the links into your own script somehow. Exactly how will vary depending on your implementation.

anonymous said:

Tuesday, November 30, 2020

Can the temporary links Script be used with links from Fileserve.com that I want to post on my website but not leave them hot all the time?

How do you install temporary links? Does it come with installation file/ instructions?

Thank you