<?php
define('MTOP', 1);
require_once('system/connect.php');
require_once('system/core.php');
require_once('system/function.php');
if(!$id OR $id < 1){
$title = 'Ошибка';
require_once ('head.php');
echo '<div class="title3">Ошибка</div>
<div class="title"><center>Сайта в базе нет</center></div>';
require_once ('foot.php');
exit;
}
$isset = mysql_query("SELECT * FROM `sait` WHERE `status` != '0' AND `id` = '".$id."'");
if(mysql_num_rows($isset) == 0){
$title = 'Ошибка';
require_once ('head.php');
echo '<div class="title3">Ошибка</div>
<div class="title"><center>Сайта в базе нет</center></div>';
require_once ('foot.php');
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`) values('".$id."','".$ip."')");
mysql_query("UPDATE `sait` SET `in` = (`in` + 1), `all_in` = (`all_in` + 1) WHERE `id` = '".$id."'");
}
header('Location: http://'.$set['home'].'/index.php?page='.$page);
?>