download counter

rh71

No Lifer
Aug 28, 2001
52,844
1,049
126
I have a site with video files and I want to implement a download counter for each download (not the number of site visits). What's the best and easiest way to accomplish this? I looked through cpanel but nothing jumped out at me. There was a CGI script that does page-visit counts but that's not what I want (unless that's the only way to do it).
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
In order to implement a download counter you will need to refer the video link through a server-side script that increments a value that you can later read and display. Typically this value is in a database, but it might also be in a file.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
^ you can also have that script run anti-hotlinking code to stop bandwidth thieves and uncredited deep linking.

1. anti-hotlinking (could be just checking referrer header)
2. counter increment
3. echo the video file

... you can find anti-hotlinking scripts that do 1 & 3, just modify the script to add 2.