Simple example of expiring download pages?
| From: | Brian Dunning | Date: | Sat, 21 Feb 2004 13:41:58 +0000 |
| Subject: | Simple example of expiring download pages? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-178441@lists.php.net to get a copy of this message | ||
Hi, I'm building a very simple online store and I need expiring download pages for people to download the items they purchased. Surprisingly, I couldn't find an example of this code online.
I know how to do it in Lasso, and it's quite easy. You just search the database against download attempts or expiration time/date, and if it succeeds, return this (it's Lasso code but you get the idea):
[Output_None]
[Var: 'file' = (Include_Raw: 'pathname/sourcefile.zip')]
[Var: 'filename' = 'product.pdf']
[Var: 'content_type' = 'application/pdf']
[Header]
HTTP/1.0 200 OK
Server: Lasso/6.0
Content-Type: [$content_type]
Content-Length: [$file->Length]
Content-Disposition: attachment; filename="[$filename]"
[/Header]
[/Output_None][$file]
Can anyone suggest the PHP code for this?