This is a more effective and usful script, it is basicly what is up there with a few structural changes, this would be full useable... all you would have to do is change the URLs...
<?php
// Extract $_GET for use
extract($_GET);
// Count hits
// Connect to your DB
mysql_connect('HOSTNAME', 'USERNAME', 'PASSWORD');
// Select DB
mysql_select_db('DB NAME');
// Do DB stuff
$sql = "SELECT hits FROM tableName WHERE sitename = '$site'";
// run query
$getResult = mysql_query($sql);
// Process with:
$getResultProcess = mysql_fetch_assoc($getResult);
$newHits = $getResultProcess++;
// Update the DB
$updatesql = "UPDATE tableName SET hits = '$newHits' WHERE sitename = '$site'";
// Run query
$updateResults = mysql_query($updatesql);
// Do URL forwarding
/************* EDIT URLS HERE!!!!!!! *****************/
if($site == '[name of a site]'){
// Forward to a URL... LEAVE IN THE QUOTES!!!
header("Location: http://site.co.uk/");
}
elseif($site == 'name of another site'){
// Forward URL... LEAVE IN THE QUOTES!!! (again)
header("Location: http://anothersite.co.uk/");
}
/****************DO NOT EDIT BELOW HERE!!!***************/
else{
// Tell the suer that something is wrong
echo 'Invalid site name. Please report this to the site administrator.<br />Quote this site name: ' . $site . '<br />Thank you for your help!';
}
?>
add elseif(){}s as appropriate...
if you save this as go.php then go.php?site=sitename will work as forwarding to that URL and adding hit to the db... (if there is a (else)if(){} statement for that site...
I hope that this script works for you!
I havn't tested this script, so it may have a few bugs to iron out...
PS... It is a complete script, nothing NEEDS to be added (hopefully) but feel free to do whatever you like with it, it is yours, but do not copyright it please, I want it to be copyright (C) 2006 ThePeccavi, but you do not have to put that on the script...
Thanks!
EDIT:
Don't forget to change the table name etc.
Enjoy!