Click to See Complete Forum and Search --> : download link hider and counter


c0le
07-31-2007, 04:01 AM
Okay, i have been searching for code that will allow me to hide the true links of a download and then count how many times that file has been downloaded and have that number be displayed next to or below each download link. How would i go about doing this?

I found the code to simply hide download links here:

http://www.webdeveloper.com/forum/showthread.php?t=152557

But how would i make it count how many times a file has been downloaded and then display it?

I am currently working on an emulator/roms site with more gaming stuff to come soon so i am dealing with a LOT of files.

NogDog
07-31-2007, 05:45 AM
Have the download script update a database entry for that file, adding 1 to a `number_downloads` field or something similar. Then in the main page query the database to get that info so it can be displayed with the related link.

Also, note that the download script in that thread you point to could possibly be a security hole. To make sure a hacker doesn't try to access other directories/files on your site, I'd recommend grabbing the $_GET value with:

$id = (isset($_GET['id'])) ? trim(basename($_GET['id'])) : ''; // strip out any directory path info