Forum Moderators: coopster

Message Too Old, No Replies

click counter

         

hermes

9:36 am on Aug 11, 2005 (gmt 0)

10+ Year Member



I have a link on my website and would be very interested to find out how many people click that link. Does anyone know any free click counter scripts? I dont mind if these use a database or not - maybe a simple incremental counter script would be fine. One thing is that I would much prefer it if the number of clicks is not shown on the actual webpage with the link on (not very proffestional). Perhaps on another webpage of my designation? Or perhaps the number of clicks not shown on the actual webpage - but in the source code of the webpage?

dreamcatcher

1:04 pm on Aug 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try hotscripts.com, there are all sorts of free click counters on there.

dc

FiRe

2:29 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



So you have links such as:

link.php?id=1
link.php?id=2
link.php?id=3

etc...
you will have a table called links with 3 fields - id (primary key, int, auto-increment), url (varchar) & clicks (int).

then in link.php you have:

<?php

## CONNECT TO DATABASE ##

//Get ID
$id = $_GET['id'];

//Update clicks
mysql_query("UPDATE links SET clicks=clicks+1 WHERE id='$id'");

//Retrieve URL
$sql = mysql_query("SELECT url FROM links WHERE id='$id'");
$fetch = mysql_fetch_row($sql);
$url = $fetch[1];

mysql_close();

//Redirect to URL
header ("Location: $url");

?>