<?php
define('MTOP', 1);
require_once('system/connect.php');
require_once('system/core.php');
require_once('system/function.php');
$ban = mysql_query("SELECT * FROM `sait` WHERE `ban` = '1' AND `id` = '".$id."'");
if(mysql_num_rows($ban) != 0){
echo 'Сайт заблокирован.';
exit;
}
if(!$id OR $id < 1){
header('Location: /?ioav');
exit;
}
$isset = mysql_query("SELECT * FROM `sait` WHERE `status` != '0' AND `id` = '".$id."'");
if(mysql_num_rows($isset) == 0){
header('Location: /?ioav');
exit;
}
$page = ceil(mysql_result(mysql_query("SELECT COUNT(*) FROM `sait` WHERE `status` = '1' AND `hosts` > '0' AND `id` = '".$id."'"), 0) / $page_top);
$sait = mysql_fetch_array($isset);

$nakrut = mysql_query("SELECT * FROM `in` WHERE `id_sait` = '".$id."' AND `ip` = '".$ip."'");
if (mysql_num_rows($nakrut) == 0){
mysql_query("INSERT INTO `in` (`id_sait`,`ip`, `time`) values('".$id."','".$ip."', ".time().")");
mysql_query("UPDATE `sait` SET `in` = (`in` + 1), `all_in` = (`all_in` + 1) WHERE `id` = '".$id."'");
}

header('Location: /?page='.$page.'&ioav&id_site='.$sait['id']);

?>