<?php

if(!$_GET['get'] OR $_GET['get'] < 1)
	{
		exit('Не верно введен идентификатор');
	}
$q = Core::count("SELECT COUNT(*) FROM `user_sites` WHERE `id`='".$_GET['get']."'");
if($q == 0)
	{
		exit('Нет такого сайта!');
	}

$site = Core::query("SELECT * FROM `user_sites` WHERE `id` = ?", array($_GET['get'])) -> fetch();
if(Core::count("SELECT COUNT(*) FROM `ip_iz_top` WHERE `ip` = ? && `id_site` = ?", array($_SERVER['REMOTE_ADDR'], $site['id'])) == false){
			Core::query("INSERT INTO `ip_iz_top` SET `ip` = ?, `id_site` = ?", array($_SERVER['REMOTE_ADDR'], $site['id']));
			Core::query("UPDATE `user_sites` SET `iz_top` = '".($site['iz_top'] + 1)."' WHERE `id` = ?", array($site['id']));
		}
header('Location: '.$site['url'].'');
?>