I've done a sponsor click tracking script with a MySQL database, it works so far, but is this the efficient code (least strain on the server, etc.)
It will be called up 10,000/day.
go.php
Code:
<?
$username = 'username';
$password = 'password';
$database = 'database';
$hostname = 'localhost';
mysql_connect($hostname, $username, $password);
mysql_select_db($database);
$domain = $_GET['site'];
mysql_query("UPDATE Sponsors SET Clicks=Clicks+1 WHERE Domain='$domain'");
$result = mysql_query("SELECT URL FROM Sponsors WHERE Domain='$domain'") or die ("Invalid entry!");
$output = mysql_fetch_row($result);
$url = ($output[0]);
mysql_close();
header("Location: $url");
?>