Results 1 to 9 of 9

Thread: Need scripts that lists how many times file downloaded

  1. #1
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need scripts that lists how many times file downloaded

    i want a script that counts and lists how many times a file has been downloaded
    or how many times a link has been clicked
    and i want it to post the number on the page for visitors to see

    can anyone provide that?

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,937
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    1 - Put the following code into a file called "counter.php";
    PHP Code:
    <?php

    $counter 
    'path/to/counter.txt'// text file to store download count - create manually and put a 0 (zero) in it to begin the count
    $download 'http://mywebsite.com/file/to/download.zip'// the link to your download file

    $number file_get_contents($counter); // read count file
    $number++; // increment count by 1
    $fh fopen($counter'w'); // open count file for writing
    fwrite($fh$number); // write new count to count file
    fclose($fh); // close count file
    header("Location: $download"); // get download
      
    ?>
    2 - Create the text file defined in the $counter value/location above and just put a 0 (zero) in it. The sample code file is called "counter.txt".

    3 - Create a download link to the "counter.php" file instead of the actual download file;
    Code:
    <a href="path/to/counter.php">DOWNLOAD</a>
    4 - To display the download count on your web page;
    PHP Code:
    <?php echo file_get_contents('path/to/counter.txt');?>
    Hope that helps
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  3. #3
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thank you

    is it possible to do this with multiple links on a single page?

    kind of like this site:
    http://www.sxc.hu/category/9001

    see under each picture it mentions how many times it has been downloaded

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,937
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    Yes, just setup a php and txt file per download.

    counter1.php, counter2.php, counter3.php, etc
    counter1.txt, counter2.txt, counter3.txt, etc

    If you want to track lots of downloads though, you'd be better off using a download/click tracker with a database: http://www.hotscripts.com/category/s...lick-tracking/
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  5. #5
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes what i need is one with a database! since i have hundreds of links and it would take too much time to make counter files for each link
    i checked out ur link....the only problem is that the scripts given there are all for the webmaster to see...i didnt really understand how i can show the download times on my page instead of just seeing it on a control panel.
    is that possible with those?

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,937
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    11

    Default

    Sorry, I have no idea as I've never needed to set one up for public display. You would need to look through a few scripts from the listing - maybe try/setup a few demos and read their documentation to find one that suits your needs - I would expect that some have that facility through referencing a database id, but each script is going to be different. You could also try contacting a few developers via their websites or if they have their own forums, approach them there.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  7. #7
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes i really liked this one that you provided in the external link :
    http://www.scottconnell.com/php/click_tracker/
    but unfortunately i couldnt figure how to show the number like he does at the end of that page
    and he hasnt placed his contacts so i can ask him!!
    bad luck i guess!

  8. #8
    Join Date
    Apr 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jfiler20 View Post
    yes i really liked this one that you provided in the external link :
    http://www.scottconnell.com/php/click_tracker/
    but unfortunately i couldnt figure how to show the number like he does at the end of that page
    and he hasnt placed his contacts so i can ask him!!
    bad luck i guess!
    What did you need help with? Contact me here http://www.scottconnell.com/send/mail/
    Last edited by ScottConnell; 04-04-2013 at 11:42 PM.

  9. #9
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Scott,
    I sent you an email asking about your script but didnt get reply

Similar Threads

  1. torrent file scripts
    By willy108 in forum PHP
    Replies: 4
    Last Post: 09-25-2007, 08:03 AM
  2. many scripts in one file
    By marringi in forum Other
    Replies: 0
    Last Post: 06-20-2007, 04:42 PM
  3. 2 Scripts on same html file.
    By Antonisid in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 04-26-2007, 07:30 PM
  4. Replies: 1
    Last Post: 08-20-2005, 10:44 AM
  5. How can I prevent a file from being downloaded?
    By inyiss in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 03-08-2005, 02:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •