|
Posted by Oli Filth on 11/12/52 11:42
Michael Vilain said the following on 15/03/2006 15:42:
> In article <1142406448.198621.67430@u72g2000cwu.googlegroups.com>,
> "ameshkin" <amir.meshkin@gmail.com> wrote:
>
>> HI,
>> I am simply trying to figure out how many times a certain MP3 file was
>> hit, and then store this number in a database. Every time the MP3 file
>> is pulled/hit/requested by someone, i want this to increment by one.
>>
>> This is probably vcery simple for someone with a little more PHP/MYSQL
>> experience than me.
>>
>> Can anyone help?
>>
>> THanks
>
> Well you could have a php script that displays a download form. The
> form, when executed would update a MySQL database with a download count,
> copy the MP3 on the server to another filename on server, then download
> the file into the browser. Be sure to set the .htaccess for the MP3
> directory to not allow browsing and put it outside the Servers document
> root.
To save the problems with having to create copies of the file (and
making sure they're uniquely named in the case of multiple users, and
clearing up at a later date), you could just have a PHP script serve up
the MP3 directly (see the PDF example in the manual at
http://php.net/header).
Alternatively, just write a script that parses your server logs.
--
Oli
[Back to original message]
|