Click to See Complete Forum and Search --> : "Click" counter for downloads


J.C.
06-01-2003, 02:20 PM
Okay, is there a quick way to add a few lines of code to have each download (click) counted and stored in a .txt file, that can be include()'d back into the page as an ongoing count?

Example: download.zip (12) <= meaning it was downloaded 12 times

If you know of any good tutorials I'd be very greateful!

Nevermore
06-01-2003, 02:30 PM
You can't put the code into a download directly, so what you would have to do is put the downloads in a directory that sin't web accessible, but that can be accessed by your scripts. I would do that using .htaccess, but you could just play with the chmod. Then you make the downloads be delivered by the PHP and have the PHP count the number, write it to a .txt file and include that.

J.C.
06-01-2003, 02:33 PM
Once upon a time I found .cgi that I could use like http://www.domainname.com/cgi-bin/counter.cgi?http://www.domainname.com/downloads/downloads.zip

and it wrote a txt file that I inturn pulled back via ssi to a static html page. Sorta looking to do the same.

Nevermore
06-02-2003, 11:06 AM
You can use a counter like that for it - you just need to make sure people can't download the files without visiting the counter page first. You can do that with .htaccess quite well if you have .htaccess capabilities. Have you?