Force Download of file in secret folder with 24 hour expiration of link for PHP

Version 1.1

Created: October 12, 2014
Last Modified: October 18, 2019
((( spellific )))
Practice spelling while playing a fun word game!
Click here to play
Speech Recognition Anywhere
  • Type emails with your voice
  • Write documents with your voice
  • Control the Internet with your voice
  • Chrome Extension
Reconocimiento de voz en cualquier lugar
  • Escribe correos electrónicos con tu voz
  • Escribe documentos con tu voz
  • Controla la Internet con tu voz
  • Extensión de Chrome
Spracherkennung Allerorts
  • Geben Sie E-Mails mit Ihrer Stimme ein
  • Schreiben Sie Dokumente mit Ihrer Stimme
  • Steuern Sie das Internet mit Ihrer Stimme
  • Chrome-Erweiterung
Reconnaissance de la parole
  • Tapez des e-mails avec votre voix
  • Écrivez des documents avec votre voix
  • Contrôlez l'Inernet avec votre voix
  • Extension Chrome
Riconoscimento vocale ovunque
  • Digita e-mail con la tua voce
  • Scrivi documenti con la tua voce
  • Controlla Internet con la tua voce
  • Estensione Chrome
どこでも
音声認識
  • あなたの声で文書を書く
  • あなたの声でメールを入力してください
  • 音声でインターネットをコントロール
  • Chrome拡張機能
语音识别
无处不在
  • 用你的声音写文件
  • 用您的声音输入电子邮件
  • 用你的声音控制互联网
  • Chrome 扩展程序
語音識別
無處不在
  • 用你的聲音寫文件
  • 用您的聲音輸入電子郵件
  • 用你的聲音控制互聯網
  • Chrome 擴展程序
Subscribe to Internet Tips and Tools Feed

Force Download of file in a secret folder with 24 hour expiration of link. Or whatever timelimit in hours you specify. The link could be used along with a PayPal Buy Now button that allows a user to download a file in a secret folder for only a specific length of time. The link could be emailed to the user or displayed on the thank you page after purchase. dlc_b

Download

Downloaded 0 times.
Please make a donation to reveal the download link.

There is no need for a database to store the key for each file because the key is created based on the current date and hour in 24 hour format. The key is encrypted with SHA1 using the secret_folder and file in the encryption.

To create a link for a file to download from the secret folder, put this on the url:

	
	download.php?secret=secretfolder123/&file=filename.ext

Where secretfolder123/ is the folder you specify in the variables you edit in download.php. It will create a link similar to:

http://seabreezecomputers.com/force_download/download.php?file=download.php&key=ef30a8e19ad0dae2748a6045bc169dba363f57de

Edit these variables in download.php:

	$secret_folder = "secretfolder123/"; // Make this random and hard to guess. It is like a password
		// Create the secret_folder on your server and place your downloadable files in there
	$hours_to_expire = 24;  // How many hours for link to expire

To add a mysql counter for file downloads use dlcounter.php at: http://www.seabreezecomputers.com/downloadcounter/ and place dlcounter.php in the same folder on the server as this file.

History

10/18/2019 - Verison 1.1c - Added isset to $_GET variables for PHP strict mode.

8/25/2017 - Version 1.1 - Changed all PHP date() functions to gmdate() to avoid 'Warning: date(): It is not safe to rely on the system's timezone settings' in newer versions of PHP.

10/12/2014 - Version 1.0 - Force download of file in secret folder created.

((( spellific )))
Practice spelling while playing a fun word game!
Click here to play
Speech Recognition Anywhere
  • Type emails with your voice
  • Write documents with your voice
  • Control the Internet with your voice
  • Chrome Extension
Reconocimiento de voz en cualquier lugar
  • Escribe correos electrónicos con tu voz
  • Escribe documentos con tu voz
  • Controla la Internet con tu voz
  • Extensión de Chrome
Spracherkennung Allerorts
  • Geben Sie E-Mails mit Ihrer Stimme ein
  • Schreiben Sie Dokumente mit Ihrer Stimme
  • Steuern Sie das Internet mit Ihrer Stimme
  • Chrome-Erweiterung
Reconnaissance de la parole
  • Tapez des e-mails avec votre voix
  • Écrivez des documents avec votre voix
  • Contrôlez l'Inernet avec votre voix
  • Extension Chrome
Riconoscimento vocale ovunque
  • Digita e-mail con la tua voce
  • Scrivi documenti con la tua voce
  • Controlla Internet con la tua voce
  • Estensione Chrome
どこでも
音声認識
  • あなたの声で文書を書く
  • あなたの声でメールを入力してください
  • 音声でインターネットをコントロール
  • Chrome拡張機能
语音识别
无处不在
  • 用你的声音写文件
  • 用您的声音输入电子邮件
  • 用你的声音控制互联网
  • Chrome 扩展程序
語音識別
無處不在
  • 用你的聲音寫文件
  • 用您的聲音輸入電子郵件
  • 用你的聲音控制互聯網
  • Chrome 擴展程序
Back to www.seabreezecomputers.com
Subscribe to Internet Tips and Tools Feed        

User Comments

There are 5 comments.

Displaying first 50 comments.

1. Posted By: Dale - - October 18, 2019, 4:16 am
Hi

I have been trying to get this to work but I am not understanding how to. I get file not found when I click on the expire link it made. is there any more instructions on how to set this up with paypal buttons? thank you

2. Posted By: Jeff - - October 18, 2019, 11:32 am
Hi Dale,

I can't really help you with setting it up with a paypal button. But you may want to practice just getting it to download the file first.  You may want to re-read the instructions on the page. I changed it a bit so hopefully it makes more sense. You may want to download the new download.php. First confirm your folder structure. Is it something like this:

public_html   
    |---- download.php
    |---- secretfolder123
                |----- file.txt

So edit download.php to have the secret_folder like this (Note the / ):
$secret_folder="secretfolder123/";

 Then create the key like this:
http://example.com/download.php?secret=secretfolder123/&file=file.txt

Jeff
www.seabreezecomputers.com/

3. Posted By: dale - - October 18, 2019, 12:43 pm
Hi jeff

Thanks for writing back yes I have check that many times I still can't get it to work :( i have been pulling my hair out on this! lol maybe its something on my hosting site? I don't know what else to do at this point.

4. Posted By: Jeff - - October 18, 2019, 1:16 pm
Hi Dale,

You might want to download the new version of download.php. It does some error checking to make sure that it can find the folder and that the file exists in the folder and tells you if it can't find it before creating the key.

Jeff
www.seabreezecomputers.com/

5. Posted By: Dale - - October 18, 2019, 2:48 pm
Hi jeff

sorry I didn't read your first msgs very well..lol about the paypal button. without knowing or having info on how to do that even if I got it to work it wouldn't help me with out knowing that info :( maybe in the future you could write something up on that so people like me know how to do it with steps.lol :) Thanks