Файл: system/top.php
Строк: 33
<?
////Топ движка
if($db->settings('top')==1){
$t_agent = shit($_SERVER['HTTP_USER_AGENT']);
$t_user = $fuser->browser(shit($_SERVER['HTTP_USER_AGENT']));
$t_ip = shit($_SERVER['REMOTE_ADDR']);
$day = date('d');
$month = date('m');
$year = date('Y');
if($aut==true)$us_id=$ya['id']; else $us_id=0;
if(($db->settings('web')==1)and((isset($_COOKIE['version']) and $_COOKIE['version']=='web')or((!isset($_COOKIE['version']))and(!$detect->isMobile() && !$detect->isTablet()))))$version_site='Полная версия'; else $version_site='Мобильная версия';
$count = $db -> dbcount('COUNT(`id`)','top',"`ip` = '".$t_ip."'");
if($count==0){
$db -> query("INSERT INTO `top` SET `ip` = '".$t_ip."',`agent` = '".$t_agent."',`month` = '".$month."',`version` = '".$version_site."',`day` = '".$day."',`year` = '".$year."',`user` = '".$t_user."',`hits`='1', `id` = '".$us_id."', `time` = '".time()."'");
}else{
$count_day = $db -> dbcount('COUNT(`id`)','top',"`day` = '".$day."' and `ip` = '".$t_ip."'");
if($count_day>0){
$db -> query("UPDATE `top` SET `hits`=hits+1 WHERE `ip` = '".$t_ip."' and `day` = '".$day."' LIMIT 1");
}else{
$db -> query("INSERT INTO `top` SET `ip` = '".$t_ip."',`agent` = '".$t_agent."',`version` = '".$version_site."',`month` = '".$month."',`day` = '".$day."',`year` = '".$year."',`user` = '".$t_user."',`hits`='1', `id` = '".$us_id."', `time` = '".time()."'");
}
}
}
?>