Jump to content

Securing downloads?


random1

Recommended Posts

How do you secure file downloads on an Apache server using PHP?

 

Basically I'm wanting to make it so that the download file (.exe) is only available to users that are registered in my MySQL database, have made a purchase. The download address needs to expire after a certain number of downloads.

Link to comment
https://forums.phpfreaks.com/topic/125743-securing-downloads/
Share on other sites

go this from php.net

<?php
// We'll be outputting a PDF
header('Content-type: 	application/octet-stream');

// It will be called file.exe
header('Content-Disposition: attachment; filename="file.exe"');

// The PDF source is in original.pdf
readfile('../file.exe'); //outside web root
?>

you could add some mysql checks at the top

 

Scott.

 

Link to comment
https://forums.phpfreaks.com/topic/125743-securing-downloads/#findComment-650240
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.