<?
require('sfb.php');
$link = intval($_GET[link]);
$row = mysql_fetch_assoc(mysql_query("SELECT * FROM tb_advban WHERE id='$link'"));
if ($row['id'] == '') {
    exit();
}
if ($row['balance'] < $row['price']) {
	exit();
}
mysql_query("UPDATE tb_advban set views=views+1,balance=balance-'$advbanner' WHERE id='$link'") or die(mysql_error());
mysql_query("INSERT INTO tb_viruchka (ident, money, month, year) VALUES (5, '$advbanner', '" . date('m', time()) . "', '" . date('Y', time()) . "')");
?>
<meta http-equiv="refresh" content="0; url=<?=$row['url']?>" />