quick and dirty version:
Setup a table in your database:
Code:
create table linklog (linklogid integer not null auto_increment primary key, name text, link text, description text)
Create a file to log and redirect clicks:
link.php
Code:
<?php
if($_GET['goto'])
{
require_once('./global.php');
global $db;
$goto = $_GET['goto'];
$db->query("UPDATE linklog SET linkcount=linkcount+1 WHERE link='$goto'");
header("Location: $goto");
}
?>
then instead of linking to "http://google.com", link to "link.php?goto=http://google.com"
To pull a count out of the database:
In your directory file you would do something like this:
Code:
$output = "";
$linklist = $db->query_read("SELECT * FROM linklog");
while($link = $linklist)
{
$url = $link['link'];
$count = $link['linkcount'];
$description = $link['description'];
$name = $link['name'];
$output .= "<p><a href='$url'>$name</a> ($count) - $description</p>";
}