i have seen mane websites have a download counter, for example near a template or a picture, "this file was downloaded xx times".... how and where can i get this counter? thanks!
well you can just update the database each time someone click on the link and then give the download file . onclick : - update database table . - give the download .
well, this is abit complicated, i'd prefer something that works like a stat counter every time a click is made. simple to implement and accurate.
found this code : <? header ("Content-type: image/jpeg"); $im = @imagecreate (200, 70) or die ("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 0, 0, 0); $file = "./count.txt"; if(file_exists($file)) $count = trim(file_get_contents($file)); else $count = 0; $count++; `echo $count > ./count.txt`; imagestring ($im, 5, 0, 0, $count, $text_color); imagejpeg($im); ?> Code (markup): or this http://www.phpjunkyard.com/php-graphical-hit-counter.php Note : i dident try any of them .
Lorelei: I'm confused... how do you think that a stat counter works, exactly? If you're talking about logging, then you need to write code that logs to a file then reads it back and parses it. It's not like there's something magical about it. It would pretty much be just as much work... actually, the DB option would be quicker to implement as well as run!
Well yes, it IS a bit complicated - In order to show this, you have to Record Downloads somewhere, and then you need to Display a count of all previous downloads. Using a database or text file to Record the previous downloads is as simple as it gets. If you accurately Record the data, then retreiving it and presenting the information will be accurate.
First thing you might want to do is open a new browser window. Then type in google.com in the address bar After that type in "free hit counter" either with or without the quotes Now, you are on your own, choose wisely