Exemplo n.º 1
0
 function SetNewDay($HOSTS = 0, $TOTAL_HOSTS = 0, $SESSIONS = 0, $HITS = 0, $NEW_GUESTS = 0, $GUESTS = 0, $FAVORITES = 0)
 {
     __SetNoKeepStatistics();
     if ($_SESSION["SESS_NO_AGENT_STATISTIC"] != "Y" && !defined("NO_AGENT_STATISTIC")) {
         $err_mess = "File: " . __FILE__ . "<br>Line: ";
         $DB = CDatabase::GetModuleConnection('statistic');
         $strSql = "SELECT D.ID FROM b_stat_day D WHERE D.DATE_STAT=CURDATE()";
         $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
         if (!$rs->Fetch()) {
             $arFields = array("DATE_STAT" => "curdate()", "C_HOSTS" => intval($HOSTS), "SESSIONS" => intval($SESSIONS), "GUESTS" => intval($GUESTS), "HITS" => intval($HITS), "FAVORITES" => intval($FAVORITES), "NEW_GUESTS" => intval($NEW_GUESTS));
             $ID = $DB->Insert("b_stat_day", $arFields, $err_mess . __LINE__, false, "", true);
         }
         //Calculate attentiveness for yesturday
         $strSql = "\n\t\t\t\tSELECT D.ID, " . $DB->DateToCharFunction("D.DATE_STAT", "SHORT") . " DATE_STAT\n\t\t\t\tFROM b_stat_day D\n\t\t\t\tWHERE D.DATE_STAT=DATE_SUB(CURDATE(),INTERVAL 1 DAY)\n\t\t\t";
         $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
         if ($ar = $rs->Fetch()) {
             $arF = CSession::GetAttentiveness($ar["DATE_STAT"]);
             if (is_array($arF)) {
                 $DB->Update("b_stat_day", $arF, "WHERE ID='" . $ar["ID"] . "'", $err_mess . __LINE__);
             }
         }
     }
     return "CStatistics::SetNewDay();";
 }