<?php

@set_time_limit(0);

$dbuser "db_username"// REPLACE db_user with the username used to connect to your database
$dbpass "db_password"// REPLACE db_pass with the password used to connect to your database
$database "database"// REPLACE database with the name of your database

mysql_pconnect("localhost",$dbuser,$dbpass);
mysql_select_db($database);

$product_id strip_tags(trim($_GET['n']));

$keywords strip_tags(trim($_GET['k']));
$keywords preg_replace("/\-/"" "$keywords);

$table "clicks";

$db_visitor_date time();
$db_ip "'".$_SERVER['REMOTE_ADDR']."'";
$db_keyword "'".$keywords."'";
$db_product_id $product_id;

$sql "INSERT INTO $table SET visitor_date = $db_visitor_date, ip = $db_ip, keyword = $db_keyword, product_id = $db_product_id";
$query mysql_query($sql);

$table "naturehills";

$sql "SELECT Link FROM $table WHERE ProductID = $db_product_id LIMIT 1";

$query mysql_query($sql);

$row mysql_fetch_array($query);

$link $row['Link'];

header("Location: ".$link);
die();
?>