<?
include_once'system/xcms_core.php';include_once 'system/head.php';
$q=$db->query("select * from `ads` where `id`='$id'")->fetch(PDO::FETCH_ASSOC);
if($q){
$db->prepare("update `ads` set `oute`=`oute`+1 where `id`='$id'")->execute();
$db->prepare("update `user` set `balans`=`balans`+1 where `id`='$user[id]'")->execute();
header('location: '.$row['link']);
}else{echo'<div class="menu">Ошибка идентификатора</div>';}
include_once 'system/foot.php';
?>