Thread: PHP: how to get most clicked link?

  1. #1
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696

    PHP: how to get most clicked link?

    I'm developing a web portal containing hyperlinks to various sites. I need a PHP solution to keep track the number of visit for each site and then move them to most-visited-sites section. So how do I know when a link get clicked? If you only know non-PHP solution I will need detailed hint, 'cause PHP is my only knowledge.
    Thnx in advance
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  2. #2
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    You'll have to use a link to a "middle-man" page. The link would be like http://www.yoursite.com/record.php?i...oothersite.com and for each link you'd have a different ID. Depending on what ID is passed to that page, you update a record in a database. The record with the highest number is the most visited. After you update the record, send them on to the destination which is in your POST/GET array using
    Code:
    header("Location: http://www.example.com/")
    , but make sure you do that before anything else gets sent to the header.

  3. #3
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    i got the idea, thnx a bunch
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked List, Please Help!
    By CodeMonkeyZ in forum C Programming
    Replies: 5
    Last Post: 02-17-2009, 06:23 AM
  2. I'm confused about link lists (again)
    By JFonseka in forum C Programming
    Replies: 4
    Last Post: 06-13-2008, 08:13 PM
  3. Function to check memory left from malloc and free?
    By Lechx in forum C Programming
    Replies: 4
    Last Post: 04-24-2006, 05:45 AM
  4. Link Error
    By Luigi in forum C++ Programming
    Replies: 1
    Last Post: 04-12-2004, 07:12 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM