Web Analytics Made Easy -
StatCounter Simple text link click "downloads" counter?!? - CodingForum

Announcement

Collapse
No announcement yet.

Simple text link click "downloads" counter?!?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple text link click "downloads" counter?!?

    Someone please help Iv been looking all over for just a SIMPLE text counter than counts the number of times a link has been clicked.. thats it.. all it displays is a number please help!

  • #2
    make your download link point to a php file..

    PHP Code:
    <?$count implode'' , @file('/downloads/filename.zip.counter' ) ) ;?>
    <a href="blah.com/download.php?file=filename.zip>download</a> (<?=$count;?> downloads to date)
    then in download.php ..

    PHP Code:
    <?
    //check its a file & USE ABSOLUTE PATH
    if( file_exists'/home/username/downloads/'.$_REQUEST[file] ) ){
        
    $count trimimplode'' file('/downloads/'.$_REQUEST[file].'.counter' ) ) );
        
    $fp fopen'/downloads/'.$_REQUEST[file].'.counter' 'w' ) ;
        
    fputs$fp , ($count+1) ) ;
        
    fclose$fp ) ;
    }
    ?>
    not tested but shoud be close
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

    Comment


    • #3
      yeh.... im not very smart... in this php stuff anything alittle simpler? lol.. or maybe a guide to installing it?

      Comment

      Working...
      X