Theories then (completely untested but in my mind should do with a but of work)...
Keep the downloadable in a folder not accessable to the webserver. Give php permission to read them. Now at this point, I don't know enough about sessions to tell you the syntax, but set a flag saying "downloading" or something, and then open the file and pass it through to the script. Once it's passed through completely, reset the flag to say "not_downloading". Obviously outside this you should have a test to see what the flag is set to in the first place... Example (download stuff borrowed from the php website <? if (flag != "downloading" // from session vars) { // set flag = "downloading"; (session vars) // begin download $completeFilePath=$fileDir.'/'.$fileName; header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header("Content-type: application/octet-stream\nContent-Disposition: inline; filename=\"".$fileName."\"\nContent-length: ".(string)(filesize($completeFilePath))); $fd=fopen($completeFilePath,'r'); while(!feof($fd)) { $buffer = fread($fn, 4096); print $buffer; } fclose($fd); // set flag = "not_downloading"; (session vars) } else { echo "you're already downloading"; } ?> Like I say, this is completely untested, but with a bit of work I believe could be persuaded to work. Obviously you'd need some security checks on the file they are trying to download (seeing as they could feasibly download any file they liked in this method) and you'd need a time-out on the session vars (like a timestamp on it) in case the script terminates prematurely and the flag is never reset. Have fun, and feel free to ask me to explain anything, it works in my mind at least! Ross -----Original Message----- From: Olivier Hubert [mailto:[EMAIL PROTECTED]] Sent: 06 May 2002 18:28 To: [EMAIL PROTECTED] Subject: [PHP-WIN] Download monitor This is probably a topic for gurus. I'd like to have some way of knowing, with PHP, when a download is finished. My site offers several files for download, and I want to make sure a given user does not download more than one file at a time. I know there is a way to do this with an Apache module, but I'm using Apache for Windows and I really don't feel like writing my own module for connection management. Users are people with sessions, so I have access to session vars and since I use a database I also have acces to MySQL tables. The configuration I use is as follow: - Apache 1.3.22 - PHP 4.1.1 - MySQL 3.23 something Again, my goal is to be able to tell when a given user has finished a download so I can give him permission to start another one. This could be done in anything, PHP, javascript, Java, I don't really care. Any help appreciated. Olivier Hubert -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php