Downloaded % times, how is it done?

Discussion in 'Web Design & Coding' started by lieb39, Jan 16, 2003.

  1. lieb39

    lieb39 Apple lover, PC User

    Messages:
    526
    Location:
    Australia
    Question,

    I notice when a person posts a attachment, for example their desktop as a .jpg, you guys (ntfs) put a lil but of text under the link, saying Downloaded % times (% = amount of times downloaded) How do you do this, or if you can, what is your code?

    Thanks
     
  2. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    Well it's like this. Each file is given an ID that is stored in the database. When you click the link it goes to a special download page (attachment.php in this case). This page checks the ID against the database, ticks off another download on a counter and redirects the browser to the acctual file.
     
  3. aswettla

    aswettla Guest

    never new that. I just don't care about how the message board handels things
     
  4. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    That's kind of the point. :) Good programming is made so that the user doesn't have to think about what happens. He/she only clicks, types and posts so to speak. :)
     
  5. sailgreg

    sailgreg Guest

    You can do this yourself with a text file, when you click the download link make it goto download.php?file={filename} have that PHP Script add +1 to the counter and then have it change the header to {filename} and it will all work nice :p
     
  6. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    Only problem is that many hosts (free anyway) deny access to the file system for security reasons. But on a paid or own server it'll work.