Jump to content

Download Counter


jamesjmann

Recommended Posts

I have music (my own) that I want to put on my website for download, and I was wondering if there is a way to keep track of how many people download each song, by tracking the clicks and displaying that number in a css-styled box. Anyone know how this is done? I don't need help with the css, just the php.

Link to comment
Share on other sites

Use AJAX to post it to another page, and JQuery to prevent it from refreshing.  Also, inside of the JQuery you can direct it to the download, so you will do both in one.  You just need to set a query function in that PHP page to handle the variables and update the database column by +1 for the correct row given by the post variables.

 

If you  need more help, just ask and I can post some code after my TV show is over.

 

A second idea without Javascript would be to just add a PHP page that you direct to with GET variables to set which row to update.  Then you have that page redirect with a header refresh, they won't know the difference between that and a direct link, and you'll get the results you want.

 

I'd go with the second idea.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.