Re: is there a way to track downloads
| From: | Duncan Hill | Date: | Sun, 23 Jun 2002 16:25:03 +0000 |
| Subject: | Re: is there a way to track downloads | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103474@lists.php.net to get a copy of this message | ||
On Sun, 23 Jun 2002, Kevin J wrote:
> Hey all,
>
> I would like to place some files on my site and use PHP to track how many
> users have downloaded those files.
>
> Is this possible?
Approach the problem logically:
1) You have a series of files that you want people to download.
2) You want to track which files are downloaded.
3) You don't want people accessing the files directly.
So, a file called download.php.
Accepts a parameter - the file name to make available.
Logs an entry of IP and file (and whatever else) to a file / database /
whatever.
Makes the file available to the user - but the path is hidden / created on
the fly so that a particular file cannot be pulled without going through the
script.
The actual code is left as an excercise for the reader.