random1 Posted September 25, 2008 Share Posted September 25, 2008 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 More sharing options...
ratcateme Posted September 25, 2008 Share Posted September 25, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.