Re: AW: [PHP] Session files? (Very Techy Questions)

From: Date: Wed, 21 Feb 2001 18:59:42 +0000
Subject: Re: AW: [PHP] Session files? (Very Techy Questions)
Groups: php.general 
Request: Send a blank email to php-general+get-41037@lists.php.net to get a copy of this message
Addressed to: Michael Zornek <mikezornek@mikezornek.com> Michael Zornek <mikezornek@mikezornek.com> "'Php-General (E-Mail)" <php-general@lists.php.net> ** Reply to note from Michael Zornek <mikezornek@mikezornek.com> Wed, 21 Feb 2001 12:15:32 -0500 > > At 5:54 PM +0100 2/21/01, Sebastian Stadtlich wrote: > When we post a new issue online we include a url right to the PDF. > Not to say we can't change that link to be somthing like: > > http://www.mysite.com/download.php?file=/TSR/0104/fullissue.pdf > > However all the old emails that are out there would still point right > to the PDF. So I guess we could make apache FWD and PDF GET requests > to the following script. Hmmm. Well I'll think about it. Hang on, this is going to be a wild ride... Lets say that you currently keep your pdf's in TSR/issue/fullissue.pdf, and that TSR is constant, issue changes each issue and fullissue.pdf may or may not be the only file in the issue directory. You hit the issue mentioned above at http://www.mysite.com/TSR/0104/fullissue.pdf. OK, here is what you do. Add the following to .htaccess or httpd.conf, in the virtual host block for www.mysite.com. If it is not a virtual host, it can be added anywhere near the bottom of the config file. <Location /TSR> ForceType application/x-httpd-php </Location> If you are using php3, it is application/x-httpd-php3 This makes apache execute the file TSR as if it was TSR.php, without having to have the .php extension. Now move your entire TSR directory outside of document root. Create a PHP program that checks to see if they are logged in and name it TSR. Place it in DocumentRoot or where ever you just removed the real TSR directory from. If they are logged in when the program is hit, then look in $PATH_INFO, which in this example will return '/0104/fullissue.php'. (Check me on the leading /, it might not be there.) Now you use $PATH_INFO and the path to where you moved the TSR directory to create the name of the file to send to them. Send your headers, then use readfile() to send the pdf. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.general (#41037) next »