<?php
defined('PROTECTOR') OR die('Ошибка: нет доступа');
$user_id = 0;
if (isset ($_SESSION['log']) && isset ($_SESSION['pas'])) {
$log = $_SESSION['log'];
$pas = $_SESSION['pas'];
}
elseif (isset ($_COOKIE['log']) && isset ($_COOKIE['pas'])) {
$log = base64_decode($_COOKIE['log']);
$_SESSION['log'] = $log;
$pas = $_COOKIE['pas'];
$_SESSION['pas'] = $pas;
}
if(isset($log)){
$req = mysql_query("SELECT * FROM `users` WHERE `usr` = '$log' AND `pass` = '".mysql_real_escape_string($pas)."' LIMIT 1");
$avto = mysql_num_rows($req);
if ($avto == 1) {
$user_id = 1;
$udata = mysql_fetch_assoc($req);
$sett = mysql_query("SELECT * FROM `set` WHERE `usr` = '$log' LIMIT 1");
$set = mysql_fetch_assoc($sett); 
$in_battle = mysql_num_rows(mysql_query("SELECT * FROM `tmp` WHERE `usr` = '$log' LIMIT 1"));
$inpk = mysql_num_rows(mysql_query("SELECT * FROM `pk` WHERE `usr` = '$log' LIMIT 1"));
$dueli = mysql_num_rows(mysql_query("SELECT * FROM `userduel` WHERE `usr` = '$log' LIMIT 1"));
$inar = mysql_num_rows(mysql_query("SELECT * FROM `arena` WHERE `usr` = '$log' LIMIT 1"));
$inryd = mysql_num_rows(mysql_query("SELECT * FROM `rydnik` WHERE `usr` = '$log' LIMIT 1"));
$div = "</div><div class='menu'>";
include('path.php');
include($path.'files/vip.php');
include($path.'files/online.php');
include($path.'files/regeneration.php');
$dater = date("d F Y года", time());
$time = date("H:i:s", time());
$dater = str_replace("January", "января", $dater);
$dater = str_replace("February", "февраля", $dater);
$dater = str_replace("March", "марта", $dater);
$dater = str_replace("April", "апреля", $dater);
$dater = str_replace("May", "мая", $dater);
$dater = str_replace("June", "июня", $dater);
$dater = str_replace("July", "июля", $dater);
$dater = str_replace("August", "августа", $dater);
$dater = str_replace("September", "сентября", $dater);
$dater = str_replace("October", "октября", $dater);
$dater = str_replace("November", "ноября", $dater);
$dater = str_replace("December", "декабря", $dater);
mysql_query("UPDATE `users` SET `lvisit` = '$dater $time' WHERE `usr` = '$log' LIMIT 1");
}
}
if(isset($_GET['site'])){
$_SESSION['site']=$_GET['site'];
}
?>