A simple php clicks script
Have you ever wondered how these links on other sites work that look something like www.othersite.com/clicks.php?id=1 ?
You can assign one link to each click id in this script which may be handy if you´re working with affiliate programs or are using other links regularly.
<? $ID = intval($_GET["ID"]);
switch($ID)
{
case 1: // Deal/Location B
$url = "http://www.affiliatesite1.com/track.php?affid=1234";
break;
case 2: // Deal/Location B
$url = “http://www.affiliatesite2.com/track.php?affid=5678″;
break;
default: // If there is an error, send them somewhere else
$url = “http://www.affiliatesite3.com/track.php?affid=5764″;
break;
}
header(“Location: $url”) ;
?>
Save this file as click.php and put it in your root directory. If you want to send somebody to your deal 1 – http://www.affiliatesite1.com/track.php?affid=1234 just enter the link www.yoursite.com/click.php?id=1 and 2 for Deal 2 and so on. You can add as many cases as you like. Pointing the default to the homepage would also make sense.
As you can see this is a very simple program for assigning and calling links from a php script. If you want to have a complete and powerful click tracking, advertising software I can suggest Openads . This software was formerly known as PHPAdsNew and is testament to the power of open source software development. If you don´t have a hosting account yet that supports Openads take a look at my webhosting reviews as these hosts all offer this script.