Hi Karl -- It depends -- you could track the download logs in a database and limit based on IP.
So your steps would be: 1) User visits PHP script 2) If the user has not downloaded the file before and if the number of downloads is less than 150 then allow them to download. 3) PHP script grabs user's IP address from $_SERVER['REMOTE_ADDR']. 4) When the script's copy function completes, register the user's IP address in a database. You can later check against this to verify they have not downloaded the file. Using IP addresses for this type of control come with problems... but depending on the importance of the content -- it should be good. Adam -----Original Message----- From: Karl DeSaulniers [mailto:k...@designdrumm.com] Sent: Friday, May 28, 2010 2:36 PM To: email@example.com Subject: Re: [PHP-DB] File Downloads On May 28, 2010, at 4:33 PM, Karl DeSaulniers wrote: > > On May 28, 2010, at 4:18 PM, Adam Schroeder wrote: > >> Hi Karl -- >> >> You can store the file contents outside of the web tree and use >> PHP to "read" the contents. This allows you to place access >> control restrictions in the PHP script. >> >> This post talks about doing something similar with images. >> Obviously, if you have a music track... you'll need to adjust the >> mime type accordingly. >> >> http://stackoverflow.com/questions/258365/php-link-to-image-file- >> outside-default-web-directory/258380#258380 >> >> Good luck. >> >> Adam >> >> >> -----Original Message----- >> From: Karl DeSaulniers [mailto:k...@designdrumm.com] >> Sent: Friday, May 28, 2010 1:39 PM >> To: firstname.lastname@example.org >> Subject: [PHP-DB] File Downloads >> >> Hello, >> How can I go about restricting the number of downloads of a file on >> my server? >> For Eg: if I want a music track to only be able to be downloaded by >> 150 people and thats it.. ever, >> how can I go about doing this? >> >> Much obliged, >> >> Karl DeSaulniers >> Design Drumm >> http://designdrumm.com >> >> > > Very Nice. Good link. > I think this is the route I may go. > Seems a bit more secure if the php script gains access to the file > through the .htaccess files set-up. > > Thanks Adam. > > Karl DeSaulniers > Design Drumm > http://designdrumm.com > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > But how do I tetect if a file has been downloaded by multiple people and in the process stop someone who has downloaded it once to not be able to do again? THX Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php