Time for them to upgrade to OSX... I've not tried to crack that nut. Is there anyone here who has successfully managed headers for Mac users? It's hard to believe it hasn't been done.
-----Original Message----- From: Kim Steinhaug [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How do I protect downloadable files? However I forgot to mention, all theese header tricks are real swell indeed, but you should get hold of a friend on a macintosh. The method I use doesnt work on the macintosh, so for the mac users we just serve the files "as is", meaning they accually dont get protected... The other methods aswell should be tested on macintosh systems just to be sure. -- Kim Steinhaug --------------------------------------------------------------- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --------------------------------------------------------------- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would go for the 3rd alternative. There are several ways to > "stream" the file with the use of headers. > > This way you can validate the user securely with your logon system, > and you can place the files outside the viewable web content. > Typically oputside your www / public_html folder. > > I use this myself in an application I use, streaming files at 50MB > does not use alot of resources at all, atleast not the way I use. > My use for the script is to serve high resolution images to several > customers, often TIF images up to 50MB and larger. > > Heres the code I use : > > $distribution= "filepathonserver"; > if ($fd = fopen ($distribution, "r")){ > $size=filesize($distribution); > $fname = basename ($distribution); > > header("Pragma: "); > header("Cache-Control: "); > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; filename=\"".$fname."\""); > header("Content-length: $size"); > > while(!feof($fd)) { > $buffer = fread($fd, 2048); > print $buffer; > } > fclose ($fd); > exit; > } > > -- > Kim Steinhaug > --------------------------------------------------------------- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --------------------------------------------------------------- > > > "Apz" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Tue, 30 Dec 2003, news.php.net wrote: > > > Creating unique symlinks would be easier but my development machine is > > > Windows and my server is FreeBSD and I can't create file links under > > > Windows. Plus, my FreeBSD server is not near me so remote development > is > > > difficult. > > > > 1) windows has symlinks since win2000, however they are named Junctions. > > I would recommend visiting sysinternals.com and getting junctions > > tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source! > > > > 2) another way is to make a redirect, so you do: > > getFile.php?file=something.zip > > > > and in your code you do: > > <? > > include "_mylibs.php" > > if (userLoggedIn()) > > header "Location: ".$_REQUEST["file"]; > > else > > echo "Only Valid People Can Login"; > > ?> > > > > 3) final way is to pass through the file yourself. Safest way, but > > potentially more resource hungry than the two above > > in your code you do: > > > > > > <? > > include "_mylibs.php" > > if (userLoggedIn()) > > { > > header("Content-type: application/octet-stream"); > > header("Content-Disposition: attachment; ". > > "filename=".$_REQUEST["file"]); > > readfile($_REQUEST["file"]); > > } > > else > > echo "Only Valid People Can Login"; > > ?> > > > > > > > > recommended reads: > > http://www.php.net/manual/en/function.header.php > > > > further recommended things to checkout: > > freshmeat , and search for anti leecher scripts. > > > > > > > > /apz, bringing joy to the world.... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php