PageRenderTime 28ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Quản lý website nội thất PHP/noithatviet/includes/core/stat.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 12 lines | 3 code | 3 blank | 6 comment | 1 complexity | 03a96b7b83d1299a3d2d40589e73ebf6 MD5 | raw file
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.4
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @Copyright (C) 2010 - 2012 VINADES.,JSC. All rights reserved
  6. * @Createdate Sun, 08 Apr 2012 00:00:00 GMT GMT
  7. */
  8. if(!defined('NV_MAINFILE'))die('Stop!!!');function nv_stat_update(){global $db,$client_info,$global_config;list($last_update)=$db->sql_fetchrow($db->sql_query("SELECT `c_count` FROM `".NV_COUNTER_TABLE."` WHERE `c_type` = 'c_time' AND `c_val`= 'last'"));if(NV_SITE_TIMEZONE_NAME==$global_config['statistics_timezone']){$last_year=date("Y",$last_update);$last_month=date("M",$last_update);$last_day=date("d",$last_update);$current_year=date('Y',NV_CURRENTTIME);$current_month=date('M',NV_CURRENTTIME);$current_day=date('d',NV_CURRENTTIME);$current_hour=date('H',NV_CURRENTTIME);$current_week=date('l',NV_CURRENTTIME);}else{date_default_timezone_set($global_config['statistics_timezone']);$last_year=date("Y",$last_update);$last_month=date("M",$last_update);$last_day=date("d",$last_update);$current_year=date('Y',NV_CURRENTTIME);$current_month=date('M',NV_CURRENTTIME);$current_day=date('d',NV_CURRENTTIME);$current_hour=date('H',NV_CURRENTTIME);$current_week=date('l',NV_CURRENTTIME);date_default_timezone_set(NV_SITE_TIMEZONE_NAME);}if($last_year!=$current_year){$query="UPDATE `".NV_COUNTER_TABLE."` SET `c_count`= 0 WHERE (`c_type`='month' OR `c_type`='day' OR `c_type`='hour')";$db->sql_query($query);}elseif($last_month!=$current_month){$query="UPDATE `".NV_COUNTER_TABLE."` SET `c_count`= 0 WHERE (`c_type`='day' OR `c_type`='hour')";$db->sql_query($query);}elseif($last_day!=$current_day){$query="UPDATE `".NV_COUNTER_TABLE."` SET `c_count`= 0 WHERE `c_type`='hour'";$db->sql_query($query);}$bot_name=($client_info['is_bot']and!empty($client_info['bot_info']['name']))?$client_info['bot_info']['name']:"Not_bot";$browser=($client_info['is_mobile'])?"Mobile":$client_info['browser']['key'];$query="UPDATE `".NV_COUNTER_TABLE."` SET `c_count`= c_count + 1, `last_update`=".NV_CURRENTTIME." WHERE \n\t(`c_type`='total' AND `c_val`='hits') OR \n\t(`c_type`='year' AND `c_val`='".$current_year."') OR \n\t(`c_type`='month' AND `c_val`='".$current_month."') OR \n\t(`c_type`='day' AND `c_val`='".$current_day."') OR \n (`c_type`='dayofweek' AND `c_val`='".$current_week."') OR \n\t(`c_type`='hour' AND `c_val`='".$current_hour."') OR \n\t(`c_type`='bot' AND `c_val`=".$db->dbescape($bot_name).") OR \n\t(`c_type`='browser' AND `c_val`=".$db->dbescape($browser).") OR \n\t(`c_type`='os' AND `c_val`=".$db->dbescape($client_info['client_os']['key']).") OR \n (`c_type`='country' AND `c_val`=".$db->dbescape($client_info['country']).")";$db->sql_query($query);$query="UPDATE `".NV_COUNTER_TABLE."` SET `c_count`= ".NV_CURRENTTIME." WHERE `c_type`='c_time' AND `c_val`= 'last'";$db->sql_query($query);}nv_stat_update();$nv_Request->set_Session('statistic_'.NV_LANG_DATA,NV_CURRENTTIME);
  9. ?>