<?php
$stop = false;
if ($system['dostup'] == 2 && empty($user_id)) $stop = true;
else if ($system['dostup'] == 3 && $user['level'] < 1) $stop = true;
else if ($system['dostup'] == 4 && $user['level'] != 1) $stop = true;
if ($stop == true)
{
die('<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=1">
<link rel="stylesheet" href="'.URL.'/design/style.css" type="text/css"/>
<link rel="stylesheet" href="'.URL.'/design/style2.css" type="text/css"/>
<title>Технічні роботи!</title>
</head>
<body style="max-width:600px;">
<div style="background: rgba(0,0,0,0.8); position: fixed; z-index: 10000; top:0; right:0; bottom:0; left:0;">
<div class="content" style="margin:auto; margin-top:10%; padding-top: 0px;"><div class="title">Технічні роботи!</div><div class="block">Сайт тимчасово недоступний!</div></div>
</div>
</body>
</html>');
}
if ($user['ban'] == 1)
{
die('<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=1">
<link rel="stylesheet" href="'.URL.'/design/style.css" type="text/css"/>
<link rel="stylesheet" href="'.URL.'/design/style2.css" type="text/css"/>
<title>Бан!</title>
</head>
<body style="max-width:600px;">
<div style="background: rgba(0,0,0,0.8); position: fixed; z-index: 10000; top:0; right:0; bottom:0; left:0;">
<div class="content" style="margin:auto; margin-top:10%; padding-top: 0px;"><div class="title">Бан!</div><div class="block">Ваша сторінка заблокована адміністрацією сайту!</div></div>
</div>
</body>
</html>');
}
if (empty($_COOKIE['visit']) || $_COOKIE['visit'] != date('d',time())) if ($mysqli->query("INSERT INTO `users_visit` SET `referer` = '".check($_SERVER['HTTP_REFERER'])."', `url` = '".check($_SERVER['HTTP_HOST'])."/".check($_SERVER['QUERY_STRING'])."', `time` = '".time()."'") == true) setcookie('visit', date('d',time()), time()+86400*365, '/');
if ($mysqli->query("SELECT `id` FROM `users` WHERE `visit` < '".(time() - 600)."' AND `online` = '1' LIMIT 1")->num_rows == true) $mysqli->query("UPDATE `users` SET `online` = '0' WHERE `visit` < '".(time() - 600)."' AND `online` = '1'");
if ($mysqli->query("SELECT `id` FROM `groups_ban` WHERE `do` < '".time()."' LIMIT 1")->num_rows == true) $mysqli->query("DELETE FROM `groups` WHERE `do` < '".time()."'");
?>