<?PHP
require('config.php'); 
$link = intval($_GET["link"]);
$row = mysql_fetch_assoc(mysql_query("SELECT `url` FROM tb_statlinks WHERE id='$link'"));
$url = $row["url"];
mysql_query("UPDATE `tb_statlinks` SET `views`=`views`+'1',`balance`=`balance`-'price' WHERE id='$link'") or die(mysql_error());
?>
<meta http-equiv="refresh" content="0; url=<?=$url; ?>">