<?php
require('config.php');

mysql_connect("$host", "$username", "$password")or die("cannot connect to the database."); 
mysql_select_db("$db_name")or die("cannot select the database.");

$id = $_GET['id'];

$result = mysql_query("SELECT * FROM ".$prefix."websites WHERE id = ".$id." ORDER BY id") or die("A MySQL error has occurred.<br />Your Query: " . $your_query . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
while($row = mysql_fetch_array($result)) {
	$website_url = $row['website_url'];

	$sql = "UPDATE ".$prefix."websites SET hits_out_total=hits_out_total+1 WHERE id=".$id; 
	if (!mysql_query($sql)) {
		die('Error: ' . mysql_error());
	}

	$sql = "UPDATE ".$prefix."websites SET hits_out=hits_out+1 WHERE id=".$id; 
	if (!mysql_query($sql)) {
		die('Error: ' . mysql_error());
	}

	header('Location: '.$website_url);
}
?>
