If u have only a few links, u might do it like this:
<?php
$logfile = "log.txt";
$links = array("link1" => "http://www.example.com", "link2" => "http://test.com");
if($links[$_GET["id"]])
{
$fp = fopen($logfile, "a");
fputs($fp, time() . ":" . $_GET["id"] . "\n");
fclose($fp);
header("Location: " . $links[$_GET["id"]]);
}
else
{
echo "Invalid link target";
}
?>
Place this in some directory, e.g. name it link.php or whatever and modify the array $links:
The key has to be an unique id and the value should contain the url assigned to that id.
Now, create links like this: http://mysite.com/link.php?id=link1
When some user clicks on your link, the script will create an entry in log.txt in the format: timestamp:id
Now u can read and evaluate this file to count your clicks.
hth