Ejemplo n.º 1
0
 function clsAWStats($sStatName, $sFilePath = "", $iYear = 0, $iMonth = 0)
 {
     // validate dates
     $dtDate = ValidateDate($iYear, $iMonth);
     $this->iYear = date("Y", $dtDate);
     $this->iMonth = date("n", $dtDate);
     // load data
     $sFilePath .= "awstats";
     if ($this->iMonth < 10) {
         $sFilePath .= "0";
     }
     $sFilePath .= $this->iMonth . $this->iYear . "." . $sStatName . ".txt";
     if (is_readable($sFilePath)) {
         $this->sAWStats = htmlspecialchars(file_get_contents($sFilePath));
         $this->bLoaded = true;
     }
     // get summary data
     $arrData = $this->GetSection("GENERAL");
     $sLastUpdate = $this->GetSummaryElement($arrData, "lastupdate", 1);
     $this->dtLastUpdate = strtotime($this->GetSummaryElement($arrData, "lastupdate", 1));
     $this->dtLastUpdate = mktime(abs(substr($sLastUpdate, 8, 2)), abs(substr($sLastUpdate, 10, 2)), abs(substr($sLastUpdate, 12, 2)), abs(substr($sLastUpdate, 4, 2)), abs(substr($sLastUpdate, 6, 2)), abs(substr($sLastUpdate, 0, 4)));
     $this->iTotalVisits = $this->GetSummaryElement($arrData, "totalvisits", 1);
     $this->iTotalUnique = $this->GetSummaryElement($arrData, "totalunique", 1);
     // populate label array
     $this->arrLabel["BROWSER"] = array("id", "hits");
     $this->arrLabel["DAY"] = array("date", "pages", "hits", "bw", "visits");
     $this->arrLabel["DOMAIN"] = array("id", "pages", "hits", "bw");
     $this->arrLabel["ERRORS"] = array("id", "hits", "bw");
     $this->arrLabel["FILETYPES"] = array("id", "hits", "bw", "noncompressedbw", "compressedbw");
     $this->arrLabel["KEYWORDS"] = array("word", "freq");
     $this->arrLabel["OS"] = array("id", "hits");
     $this->arrLabel["PAGEREFS"] = array("url", "pages", "hits");
     $this->arrLabel["ROBOT"] = array("id", "hits", "bw", "lastvisit", "robotstxt");
     $this->arrLabel["SEARCHWORDS"] = array("phrase", "freq");
     $this->arrLabel["SEREFERRALS"] = array("id", "pages", "hits");
     $this->arrLabel["SESSION"] = array("range", "freq");
     $this->arrLabel["SIDER"] = array("url", "pages", "bw", "entry", "exit");
     $this->arrLabel["SIDER_404"] = array("url", "hits", "referrer");
     $this->arrLabel["TIME"] = array("hour", "pages", "hits", "bw", "notviewedpages", "notviewedhits", "notviewedbw");
 }
Ejemplo n.º 2
0
 function clsAWStats($sStatName, $sFilePath = "", $sFileName = "", $iYear = 0, $iMonth = 0)
 {
     // validate dates
     $dtDate = ValidateDate($iYear, $iMonth);
     $this->iYear = date("Y", $dtDate);
     $this->iMonth = date("n", $dtDate);
     // load data
     if (strlen($sFileName) == 0) {
         $sFileName = "awstats[MM][YYYY]." . $sStatName . ".txt";
         if ($GLOBALS["bUTF8LogFiles"]) {
             $sFileName .= ".utf8";
         }
     }
     $sFileName = str_replace("[YYYY]", $this->iYear, $sFileName);
     $sFileName = str_replace("[YY]", substr($this->iYear, 2), $sFileName);
     if ($this->iMonth < 10) {
         $sFileName = str_replace("[MM]", "0" . $this->iMonth, $sFileName);
     } else {
         $sFileName = str_replace("[MM]", $this->iMonth, $sFileName);
     }
     $sFileName = str_replace("[M]", $this->iMonth, $sFileName);
     $sFilePath = $sFilePath . $sFileName;
     $this->sFileName = $sFileName;
     if (is_readable($sFilePath)) {
         $this->sAWStats = htmlspecialchars(file_get_contents($sFilePath));
         $this->bLoaded = true;
     } else {
         return;
     }
     // get summary data
     $arrData = $this->GetSection("GENERAL");
     $sLastUpdate = $this->GetSummaryElement($arrData, "lastupdate", 1);
     $this->dtLastUpdate = strtotime($this->GetSummaryElement($arrData, "lastupdate", 1));
     $this->dtLastUpdate = mktime(abs(substr($sLastUpdate, 8, 2)), abs(substr($sLastUpdate, 10, 2)), abs(substr($sLastUpdate, 12, 2)), abs(substr($sLastUpdate, 4, 2)), abs(substr($sLastUpdate, 6, 2)), abs(substr($sLastUpdate, 0, 4)));
     $this->iTotalVisits = $this->GetSummaryElement($arrData, "totalvisits", 1);
     $this->iTotalUnique = $this->GetSummaryElement($arrData, "totalunique", 1);
     // populate label array
     $this->arrLabel["BROWSER"] = array("id", "hits");
     $this->arrLabel["DAY"] = array("date", "pages", "hits", "bw", "visits");
     $this->arrLabel["DOMAIN"] = array("id", "pages", "hits", "bw");
     $this->arrLabel["ERRORS"] = array("id", "hits", "bw");
     $this->arrLabel["FILETYPES"] = array("id", "hits", "bw", "noncompressedbw", "compressedbw");
     $this->arrLabel["KEYWORDS"] = array("word", "freq");
     $this->arrLabel["OS"] = array("id", "hits");
     $this->arrLabel["PAGEREFS"] = array("url", "pages", "hits");
     $this->arrLabel["ROBOT"] = array("id", "hits", "bw", "lastvisit", "robotstxt");
     $this->arrLabel["SEARCHWORDS"] = array("phrase", "freq");
     $this->arrLabel["SEREFERRALS"] = array("id", "pages", "hits");
     $this->arrLabel["SESSION"] = array("range", "freq");
     $this->arrLabel["SIDER"] = array("url", "pages", "bw", "entry", "exit");
     $this->arrLabel["SIDER_404"] = array("url", "hits", "referrer");
     $this->arrLabel["TIME"] = array("hour", "pages", "hits", "bw", "notviewedpages", "notviewedhits", "notviewedbw");
     $this->arrLabel["VISITOR"] = array("address", "pages", "hits", "bw", "lastvisit", "lastvisitstart", "lastvisitpage", "desc");
     $this->arrLabel["EMAILSENDER"] = array("address", "emails", "bw", "lastvisit");
     $this->arrLabel["EMAILRECEIVER"] = array("address", "emails", "bw", "lastvisit");
     $this->arrLabel["PLUGIN_geoip_city_maxmind"] = array("id", "pages", "hits", "bw", "lastvisit");
     $this->arrLabel["PLUGIN_geoip_org_maxmind"] = array("id", "pages", "hits", "bw", "lastvisit");
     // days in month
     if ($this->iYear == date("Y") && $this->iMonth == date("n")) {
         $this->iDaysInMonth = abs(date("s", $this->dtLastUpdate));
         $this->iDaysInMonth += abs(date("i", $this->dtLastUpdate)) * 60;
         $this->iDaysInMonth += abs(date("H", $this->dtLastUpdate)) * 60 * 60;
         $this->iDaysInMonth = abs(date("j", $this->dtLastUpdate) - 1) + $this->iDaysInMonth / (60 * 60 * 24);
     } else {
         $this->iDaysInMonth = date("d", mktime(0, 0, 0, date("n", $this->dtLastUpdate), 0, date("Y", $this->dtLastUpdate)));
     }
     // start of the month
     $this->dtStartOfMonth = mktime(0, 0, 0, $this->iMonth, 1, $this->iYear);
     $this->iDailyVisitAvg = $this->iTotalVisits / $this->iDaysInMonth;
     $this->iDailyUniqueAvg = $this->iTotalUnique / $this->iDaysInMonth;
 }
Ejemplo n.º 3
0
$g_sConfig = GetConfig();
$g_aConfig = $aConfig[$g_sConfig];
$sLanguageCode = SetTranslation();
// external include files
if (isset($g_aConfig["includes"]) == true && strlen($g_aConfig["includes"]) > 0) {
    $aIncludes = explode(",", $g_aConfig["includes"]);
    foreach ($aIncludes as $sInclude) {
        include $sInclude;
    }
}
// get date range and valid log file
$year = array_key_exists("year", $_GET) ? $_GET["year"] : NULL;
$month = array_key_exists("month", $_GET) ? $_GET["month"] : NULL;
$statsname = array_key_exists("statsname", $g_aConfig) ? $g_aConfig["statsname"] : NULL;
$parts = array_key_exists("parts", $g_aConfig) ? $g_aConfig["parts"] : NULL;
$g_dtStatsMonth = ValidateDate($year, $month);
$g_aLogFiles = GetLogList($g_sConfig, $g_aConfig["statspath"], $statsname, $parts);
$g_iThisLog = -1;
for ($iIndex = 0; $iIndex < count($g_aLogFiles); $iIndex++) {
    if ($g_dtStatsMonth == $g_aLogFiles[$iIndex][0] && $g_aLogFiles[$iIndex][1] == true) {
        $g_iThisLog = $iIndex;
        break;
    }
}
if ($g_iThisLog < 0) {
    if (count($g_aLogFiles) > 0) {
        $g_iThisLog = 0;
    } else {
        Error("NoLogsFound");
    }
}
Ejemplo n.º 4
0
require_once "clsAWStats.php";
// external include files
if (isset($g_aConfig["includes"]) == true && strlen($g_aConfig["includes"]) > 0) {
    $aIncludes = explode(",", $g_aConfig["includes"]);
    foreach ($aIncludes as $sInclude) {
        include $sInclude;
    }
}
// select configuraton
$g_sConfig = GetConfig();
$g_aConfig = $aConfig[$g_sConfig];
if (isset($_GET["part"])) {
    $g_sConfig = $g_sConfig . "." . $_GET["part"];
}
// get date range and valid log file
$g_dtStatsMonth = ValidateDate(isset($_GET["year"]) ? $_GET["year"] : null, isset($_GET["month"]) ? $_GET["month"] : null);
$g_aLogFiles = GetLogList($g_sConfig, $g_aConfig["statspath"], $g_aConfig["statsname"]);
// create xml
$aXML = array();
$aXML[] = "<data>";
$iYear = date("Y", $g_aLogFiles[count($g_aLogFiles) - 1][0]);
$iMonth = date("n", $g_aLogFiles[count($g_aLogFiles) - 1][0]);
$iMaxLastUpdate = 0;
for ($iIndex = count($g_aLogFiles) - 1; $iIndex >= 0; $iIndex--) {
    $dtNextMonth = mktime(0, 0, 0, $iMonth + 1, 0, $iYear);
    $clsAWStats = new clsAWStats($g_sConfig, $g_aConfig["statspath"], isset($g_aConfig["statsname"]) ? $g_aConfig["statsname"] : null, date("Y", $g_aLogFiles[$iIndex][0]), date("n", $g_aLogFiles[$iIndex][0]));
    if ($clsAWStats->dtLastUpdate > $iMaxLastUpdate) {
        $iMaxLastUpdate = $clsAWStats->dtLastUpdate;
    }
    // sum pages, hits & bandwidth
    $aTemp = $clsAWStats->GetSection("DAY");
Ejemplo n.º 5
0
 */
// includes
require_once "config.php";
require_once "clsAWStats.php";
// external include files
if (isset($g_aConfig["includes"]) == true && strlen($g_aConfig["includes"]) > 0) {
    $aIncludes = explode(",", $g_aConfig["includes"]);
    foreach ($aIncludes as $sInclude) {
        include $sInclude;
    }
}
// select configuraton
$g_sConfig = GetConfig();
$g_aConfig = $aConfig[$g_sConfig];
// get date range and valid log file
$g_dtStatsMonth = ValidateDate($_GET["year"], $_GET["month"]);
$g_aLogFiles = GetLogList($g_sConfig, $g_aConfig["statspath"]);
// create xml
$aXML = array();
$aXML[] = "<data>";
$iYear = date("Y", $g_aLogFiles[count($g_aLogFiles) - 1][0]);
$iMonth = date("n", $g_aLogFiles[count($g_aLogFiles) - 1][0]);
$iMaxLastUpdate = 0;
for ($iIndex = count($g_aLogFiles) - 1; $iIndex >= 0; $iIndex--) {
    $dtNextMonth = mktime(0, 0, 0, $iMonth + 1, 0, $iYear);
    $clsAWStats = new clsAWStats($g_sConfig, $g_aConfig["statspath"], date("Y", $g_aLogFiles[$iIndex][0]), date("n", $g_aLogFiles[$iIndex][0]));
    if ($clsAWStats->dtLastUpdate > $iMaxLastUpdate) {
        $iMaxLastUpdate = $clsAWStats->dtLastUpdate;
    }
    // sum pages, hits & bandwidth
    $aTemp = $clsAWStats->GetSection("DAY");