Counter - every time link is clicked!

Discussion in 'Programming' started by Jonezyuk, Feb 18, 2010.

  1. #1
    hey i want a counter that when a link is clicked it counts


    for downloads - say how many times the download button is clicked!
     
    Jonezyuk, Feb 18, 2010 IP
  2. Darkhodge

    Darkhodge Well-Known Member

    Messages:
    2,111
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    185
    #2
    You could use PHP and a MySQL DB. You could set up a table like this:

    
    id  url                     count
    1  files/aLogo.psd       23
    2  files/anEbook.pdf    61
    3  files/aSong.mp3      12
    
    Code (markup):
    Then what you can do is set up a redirect page that handles your counter for you. The redirect page would:

    • Use the linkID specified to grab the relevant record.
    • Extract the information.
    • Increment the counter.
    • Update the table with the updated counter.
    • Redirect the user using "header('Location: $linkURL');" or whatever.

    I'm assuming you have some programming knowledge here, if not give me a shout and I'll elaborate if I'm not too busy! :)
     
    Darkhodge, Feb 20, 2010 IP
  3. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you looking for a hit counter, see this one.

    If you are looking for a outbound link click counter see this one.
     
    NeoCambell, Feb 21, 2010 IP