0){ for($i=0; $row = assoc($rs); $i++){ //echo $row['hourTime'].'
'; $siteCode = $row['at_site_only']; $hourTime = $row['hourTime']; $dayTime = $row['dayTime']; $monthTime = $row['monthTime']; $yearTime = $row['yearTime']; $visitCnt = $row['at_visit_cnt']; $isWeb = $row['at_type'] == 'WEB' ? 1 : 0; $isMobile = $row['at_type'] == 'MOBILE' ? 1 : 0; $isApp = $row['at_type'] == 'APP' ? 1 : 0; $traffic = getVisitFn('MADE', str_replace('WEB@', 'MOBILEAPP@', $row['agent'])); $os = getVisitFn('OS', str_replace('WEB@', 'MOBILEAPP@', $row['agent'])); //echo $os; $isAndroid = 0; $isIos = 0; $isWindows = 0; $isLinux = 0; $isRobot = 0; $isEtc = 0; if(strstr(strtolower($traffic), 'bot')){ $isAndroid = 0; $isIos = 0; $isWindows = 0; $isLinux = 0; $isRobot = 1; $isEtc = 0; }else{ if(strstr(strtolower($os), 'android')){ $isAndroid = 1; $isIos = 0; $isWindows = 0; $isLinux = 0; $isRobot = 0; $isEtc = 0; }else if(strstr(strtolower($os), 'mac')){ $isAndroid = 0; $isIos = 1; $isWindows = 0; $isLinux = 0; $isRobot = 0; $isEtc = 0; }else if(strstr(strtolower($os), 'windows')){ $isAndroid = 0; $isIos = 0; $isWindows = 1; $isLinux = 0; $isRobot = 0; $isEtc = 0; }else if(strstr(strtolower($os), 'linux')){ $isAndroid = 0; $isIos = 0; $isWindows = 0; $isLinux = 1; $isRobot = 0; $isEtc = 0; }else{ $isAndroid = 0; $isIos = 0; $isWindows = 0; $isLinux = 0; $isRobot = 0; $isEtc = 1; } } $getHourDb = getValue("app_linkcore_db._TRAFFIC_HOUR", " where th_date = '".$hourTime."' and th_site = '".$siteCode."' ", 'th_date', 'th_date'); if(!$getHourDb){ $hourSql = " insert into app_linkcore_db._TRAFFIC_HOUR set th_date = '".$hourTime."' , th_web = ".$isWeb." , th_mobile = ".$isMobile." , th_app = ".$isApp." , th_android= ".$isAndroid." , th_ios = ".$isIos." , th_windows= ".$isWindows." , th_linux = ".$isLinux." , th_robot = ".$isRobot." , th_etc = ".$isEtc." , th_cnt = 1 , th_site = '".$siteCode."' "; }else{ $hourSql = " update app_linkcore_db._TRAFFIC_HOUR set th_web = th_web+".$isWeb." , th_mobile = th_mobile+".$isMobile." , th_app = th_app+".$isApp." , th_android= th_android+".$isAndroid." , th_ios = th_ios+".$isIos." , th_windows= th_windows+".$isWindows." , th_linux = th_linux+".$isLinux." , th_robot = th_robot+".$isRobot." , th_etc = th_etc+".$isEtc." , th_cnt = th_cnt+1 where th_date = '".$hourTime."' and th_site = '".$siteCode."' "; } query($hourSql); $getDayDb = getValue("app_linkcore_db._TRAFFIC_DAY", " where td_date = '".$dayTime."' and td_site = '".$siteCode."' ", 'td_date', 'td_date'); if(!$getDayDb){ $daySql = " insert into app_linkcore_db._TRAFFIC_DAY set td_date = '".$dayTime."' , td_web = ".$isWeb." , td_mobile = ".$isMobile." , td_app = ".$isApp." , td_android= ".$isAndroid." , td_ios = ".$isIos." , td_windows= ".$isWindows." , td_linux = ".$isLinux." , td_robot = ".$isRobot." , td_etc = ".$isEtc." , td_cnt = 1 , td_site = '".$siteCode."' "; }else{ $daySql = " update app_linkcore_db._TRAFFIC_DAY set td_web = td_web+".$isWeb." , td_mobile = td_mobile+".$isMobile." , td_app = td_app+".$isApp." , td_android= td_android+".$isAndroid." , td_ios = td_ios+".$isIos." , td_windows= td_windows+".$isWindows." , td_linux = td_linux+".$isLinux." , td_robot = td_robot+".$isRobot." , td_etc = td_etc+".$isEtc." , td_cnt = td_cnt+1 where td_date = '".$dayTime."' and td_site = '".$siteCode."' "; } query($daySql); $getMonthDb = getValue("app_linkcore_db._TRAFFIC_MONTH", " where tm_date = '".$monthTime."' and tm_site = '".$siteCode."' ", 'tm_date', 'tm_date'); if(!$getMonthDb){ $monthSql = " insert into app_linkcore_db._TRAFFIC_MONTH set tm_date = '".$monthTime."' , tm_web = ".$isWeb." , tm_mobile = ".$isMobile." , tm_app = ".$isApp." , tm_android= ".$isAndroid." , tm_ios = ".$isIos." , tm_windows= ".$isWindows." , tm_linux = ".$isLinux." , tm_robot = ".$isRobot." , tm_etc = ".$isEtc." , tm_cnt = 1 , tm_site = '".$siteCode."' "; }else{ $monthSql = " update app_linkcore_db._TRAFFIC_MONTH set tm_web = tm_web+".$isWeb." , tm_mobile = tm_mobile+".$isMobile." , tm_app = tm_app+".$isApp." , tm_android= tm_android+".$isAndroid." , tm_ios = tm_ios+".$isIos." , tm_windows= tm_windows+".$isWindows." , tm_linux = tm_linux+".$isLinux." , tm_robot = tm_robot+".$isRobot." , tm_etc = tm_etc+".$isEtc." , tm_cnt = tm_cnt+1 where tm_date = '".$monthTime."' and tm_site = '".$siteCode."' "; } query($monthSql); $getYearDb = getValue("app_linkcore_db._TRAFFIC_YEAR", " where ty_date = '".$yearTime."' and ty_site = '".$siteCode."' ", 'ty_date', 'ty_date'); if(!$getYearDb){ $yearSql = " insert into app_linkcore_db._TRAFFIC_YEAR set ty_date = '".$yearTime."' , ty_web = ".$isWeb." , ty_mobile = ".$isMobile." , ty_app = ".$isApp." , ty_android= ".$isAndroid." , ty_ios = ".$isIos." , ty_windows= ".$isWindows." , ty_linux = ".$isLinux." , ty_robot = ".$isRobot." , ty_etc = ".$isEtc." , ty_cnt = 1 , ty_site = '".$siteCode."' "; }else{ $yearSql = " update app_linkcore_db._TRAFFIC_YEAR set ty_web = ty_web+".$isWeb." , ty_mobile = ty_mobile+".$isMobile." , ty_app = ty_app+".$isApp." , ty_android= ty_android+".$isAndroid." , ty_ios = ty_ios+".$isIos." , ty_windows= ty_windows+".$isWindows." , ty_linux = ty_linux+".$isLinux." , ty_robot = ty_robot+".$isRobot." , ty_etc = ty_etc+".$isEtc." , ty_cnt = ty_cnt+1 where ty_date = '".$yearTime."' and ty_site = '".$siteCode."' "; } query($yearSql); } } // query("update app_linkcore_db._APP_LINK set at_move_is = 'Y' where at_idx = '".$KEY."' "); } } ?>