Файл: system/xcms_core.php
Строк: 63
<?php
include 'xcms_func.php';
include 'xcms_set.php';
if(isset($_COOKIE['login'], $_COOKIE['password'])){
$query=$db->query("select * from `user` where `login`='".protect($_COOKIE['login'])."' and `password`='".protect($_COOKIE['password'])."'")->fetch(PDO::FETCH_ASSOC);
if($query){
$user=$query;
$db->prepare("update `user` set `visit`='$time',`ip`='$sess_ip',`ua`='$sess_ua' where `id`='$user[id]'")->execute();
}else{$user=0;}
}else{$user = 0;}
if(!$user){
$w=$db->query("select `id` from `online` where `ip`='$sess_ip' and `soft`='$sess_ua'")->rowCount();
if($w)
$db->prepare("update `online` set `time`='$time' where `ip`='$sess_ip' and `soft`='$sess_ua'")->execute();
else
$db->query("insert into `online` set `ip`='$sess_ip', `soft`='$sess_ua', `time`='$time'");
}
$ho=$db->query("select `id` from `host` where `ip`='$sess_ip' and `soft`='$sess_ua' and `d`='$day' and `m`='$mon' and `y`='$yea'")->rowCount();
if(!$ho)$db->query("insert into `host` set `ip`='$sess_ip', `soft`='$sess_ua', `d`='$day', `m`='$mon', `y`='$yea'");
$db->query("insert into `hit` set `ip`='$sess_ip', `soft`='$sess_ua', `d`='$day', `m`='$mon', `y`='$yea'");
$online_g=$db->query("select `id` from `online` where `time`>($time-90)")->rowCount();
$online_u=$db->query("SELECT `id` from `user` where `visit`>$time-90")->rowCount();
$online_all=($online_g+$online_u);
if($online_all>$da['record_online'])$db->prepare("update `setting` set `record_online`='$online_all', `record_online_time`='$time'")->execute();
if($host_all>$da['record_host'])$db->prepare("update `setting` set `record_host`='$host_all', `record_host_time`='$time'")->execute();
if($hit_all>$da['record_hit'])$db->prepare("update `setting` set `record_hit`='$hit_all', `record_hit_time`='$time'")->execute();
if($user){
if($user['ban_time']){
if($user['ban_time']<$time){
$db->prepare("update `user` set `ban_time`='0', `ban_reas`='0', `ban_adm`='0' where `id`='$user[id]'")->execute();
}else{exit();}
}
}
?>