From 036c7d56368943a81b702e3cf5b2262fdd15982c Mon Sep 17 00:00:00 2001
From: akshat0047
Date: Sun, 31 May 2020 00:32:03 +0530
Subject: Added basic files without generalised used
---
awdash/.env | 2 +
awdash/bootstrap.php | 11 ++
awdash/composer.json | 10 ++
awdash/composer.lock | 163 ++++++++++++++++++++
awdash/public/index.css | 86 +++++++++++
awdash/public/index.html | 112 ++++++++++++++
awdash/public/index.js | 79 ++++++++++
awdash/public/index.php | 39 +++++
awdash/public/sites.json | 11 ++
awdash/src/Controller/WebsiteController.php | 122 +++++++++++++++
server/awstats.php | 171 +++++++++++++++++++++
server/class.awfile.php | 221 ++++++++++++++++++++++++++++
12 files changed, 1027 insertions(+)
create mode 100644 awdash/.env
create mode 100644 awdash/bootstrap.php
create mode 100644 awdash/composer.json
create mode 100644 awdash/composer.lock
create mode 100644 awdash/public/index.css
create mode 100644 awdash/public/index.html
create mode 100644 awdash/public/index.js
create mode 100644 awdash/public/index.php
create mode 100644 awdash/public/sites.json
create mode 100755 awdash/src/Controller/WebsiteController.php
create mode 100644 server/awstats.php
create mode 100644 server/class.awfile.php
diff --git a/awdash/.env b/awdash/.env
new file mode 100644
index 0000000..8cc6794
--- /dev/null
+++ b/awdash/.env
@@ -0,0 +1,2 @@
+OKTAAUDIENCE=
+HOST=
diff --git a/awdash/bootstrap.php b/awdash/bootstrap.php
new file mode 100644
index 0000000..256564b
--- /dev/null
+++ b/awdash/bootstrap.php
@@ -0,0 +1,11 @@
+load();
+
+// test code, should output:
+// api://default
+// when you run $ php bootstrap.php
+//echo getenv('OKTAAUDIENCE');
diff --git a/awdash/composer.json b/awdash/composer.json
new file mode 100644
index 0000000..00cec7c
--- /dev/null
+++ b/awdash/composer.json
@@ -0,0 +1,10 @@
+{
+ "require": {
+ "vlucas/phpdotenv": "^2.4"
+ },
+ "autoload": {
+ "psr-4": {
+ "Src\\": "src/"
+ }
+ }
+}
diff --git a/awdash/composer.lock b/awdash/composer.lock
new file mode 100644
index 0000000..efe8b40
--- /dev/null
+++ b/awdash/composer.lock
@@ -0,0 +1,163 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "913950ad60dd11bbcdf3b8f3c8b0c052",
+ "packages": [
+ {
+ "name": "symfony/polyfill-ctype",
+ "version": "v1.17.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-ctype.git",
+ "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
+ "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-ctype": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.17-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Ctype\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Gert de Pagter",
+ "email": "BackEndTea@gmail.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for ctype functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "ctype",
+ "polyfill",
+ "portable"
+ ],
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-05-12T16:14:59+00:00"
+ },
+ {
+ "name": "vlucas/phpdotenv",
+ "version": "v2.6.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/vlucas/phpdotenv.git",
+ "reference": "67d472b1794c986381a8950e4958e1adb779d561"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/67d472b1794c986381a8950e4958e1adb779d561",
+ "reference": "67d472b1794c986381a8950e4958e1adb779d561",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.9 || ^7.0 || ^8.0",
+ "symfony/polyfill-ctype": "^1.9"
+ },
+ "require-dev": {
+ "ext-filter": "*",
+ "ext-pcre": "*",
+ "phpunit/phpunit": "^4.8.35 || ^5.0"
+ },
+ "suggest": {
+ "ext-filter": "Required to use the boolean validator.",
+ "ext-pcre": "Required to use most of the library."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Dotenv\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "graham@alt-three.com",
+ "homepage": "https://gjcampbell.co.uk/"
+ },
+ {
+ "name": "Vance Lucas",
+ "email": "vance@vancelucas.com",
+ "homepage": "https://vancelucas.com/"
+ }
+ ],
+ "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
+ "keywords": [
+ "dotenv",
+ "env",
+ "environment"
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-05-02T13:38:00+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "1.1.0"
+}
diff --git a/awdash/public/index.css b/awdash/public/index.css
new file mode 100644
index 0000000..27aaabc
--- /dev/null
+++ b/awdash/public/index.css
@@ -0,0 +1,86 @@
+body{
+ position: relative;
+ width: 100%;
+ height: auto;
+ overflow-x:hidden;
+ overflow-y:auto;
+ background-color: rgb(255, 255, 255);
+ outline-box: none;
+}
+
+header{
+ box-shadow: 0 0 2px 2px rgba(0,0,0,0.2);
+}
+
+form{
+ margin: auto;
+}
+
+#filterform{
+ position: relative;
+ padding:1%;
+}
+
+.loader{
+ position: fixed;
+ margin: auto;
+ left: 0px;
+ right: 0px;
+ bottom: 0px;
+ top: 0px;
+ z-index: 5;
+}
+
+.input-col{
+ position: relative;
+ margin:5px !important;
+}
+
+select, option {
+ position: relative;
+ width:200px;
+}
+
+.cards-form{
+ position: relative;
+ text-align: center;
+ margin:auto;
+ left: 0px;
+ right:0px;
+}
+
+.input-col{
+ position: relative;
+ text-align:center;
+ margin:auto;
+ left:0px;
+ right:0px;
+}
+
+.table-box{
+ position: relative;
+ width: 100%;
+ height:100%;
+ top: 50px;
+ padding-bottom:60px;
+}
+
+
+footer{
+ position: fixed;
+ width: 100%;
+ height: 8%;
+ bottom: 0px;
+ box-shadow: 0 0 2px 2px rgba(0,0,0,0.2);
+ background: rgb(43, 42, 42);
+}
+
+.ft-col{
+ position: relative;
+ text-align: center;
+ color: white;
+}
+
+.ft-col > span {
+ position: relative;
+}
diff --git a/awdash/public/index.html b/awdash/public/index.html
new file mode 100644
index 0000000..6ab6e8e
--- /dev/null
+++ b/awdash/public/index.html
@@ -0,0 +1,112 @@
+
+
+
+
+
+ Awdash Beta
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # |
+ Website |
+ Unique Visits(Monthly) |
+ Total Visits |
+ Total Page Loads |
+ Hits |
+ Bandwidth |
+ Link |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/awdash/public/index.js b/awdash/public/index.js
new file mode 100644
index 0000000..134b98b
--- /dev/null
+++ b/awdash/public/index.js
@@ -0,0 +1,79 @@
+$(document).ready(function() {
+
+var today = new Date();
+var dd = today.getDate();
+var mm = today.getMonth()+1;
+var yyyy = today.getFullYear();
+var defaultdate;
+
+if(dd<10)
+{
+ dd='0'+dd;
+}
+if(mm<10)
+{
+ mm='0'+mm;
+}
+
+function getAll(time = "01012013" + dd + mm + yyyy, website = "")
+{
+//console.log("time= " + time + "website = " + website);
+$("#table-body").css("visibility","hidden");
+$("#loading").css("display","block");
+
+var url = "https://Domain/websites/" + time + "/" + website;
+$.get(url, function(data, status){
+ var rows = "";
+// console.log(data);
+ for(var i=0; i" +
+ "" + data[i].sno + " | " +
+ "" + data[i].website + " | " +
+ "" + data[i].unique_visit + " | " +
+ "" + data[i].total_visit + " | " +
+ "" + data[i].total_page_loads + " | " +
+ "" + data[i].total_hits + " | " +
+ "" + data[i].total_bandwidth + " | " +
+ "Click Here | " +
+ "";
+ }
+
+ $("#table-body").html(rows);
+ $("#loading").css("display","none");
+ $("#table-body").css("visibility","visible");
+
+ });
+}
+
+$("#filter").click(e => {
+ e.preventDefault();
+ let website = $("#myselect").val();
+ let time = ($("input")[0].value).split("-")[2] + ($("input")[0].value).split("-")[1] + ($("input")[0].value).split("-")[0] +
+ ($("input")[1].value).split("-")[1] + ($("input")[1].value).split("-")[1] + ($("input")[1].value).split("-")[0];
+
+ if(time.includes("undefined"))
+ time = null;
+
+ if(time && website)
+ getAll(time, website);
+ else if(time)
+ getAll(time);
+ else
+ getAll(defaultdate+dd+mm+yyyy, website);
+ });
+
+$("#reset").click(e => {
+ e.preventDefault();
+ getAll();
+ });
+
+$.getJSON("sites.json", function(json) {
+ defaultdate = json['defaultdate'];
+ $.each(json['sites'], (index, value) => {
+ val = parseInt(index, 10) + 1;
+ $("#myselect").append("");
+ });
+ getAll();
+});
+});
diff --git a/awdash/public/index.php b/awdash/public/index.php
new file mode 100644
index 0000000..937336e
--- /dev/null
+++ b/awdash/public/index.php
@@ -0,0 +1,39 @@
+processRequest();
diff --git a/awdash/public/sites.json b/awdash/public/sites.json
new file mode 100644
index 0000000..987c8a5
--- /dev/null
+++ b/awdash/public/sites.json
@@ -0,0 +1,11 @@
+{
+ "defaultdate":"default start date of logs",
+ "sites":[{
+ "domain":"domain to show in the list as name",
+ "awstats":"link of individual awstats url for the domain"
+ },
+ {
+ "domain":"",
+ "awstats":""
+ }]
+}
diff --git a/awdash/src/Controller/WebsiteController.php b/awdash/src/Controller/WebsiteController.php
new file mode 100755
index 0000000..612391f
--- /dev/null
+++ b/awdash/src/Controller/WebsiteController.php
@@ -0,0 +1,122 @@
+requestMethod = $requestMethod;
+ $this->website = (int)$website;
+ $this->time = $time;
+ }
+
+ public function processRequest()
+ {
+ switch ($this->requestMethod) {
+ case 'GET':
+ $response = $this->getData($this -> time, $this -> website);
+ break;
+ case 'POST':
+ $response = $this->methodNotAllowed();
+ break;
+ /*case 'PUT':
+ $response = $this->updateUserFromRequest($this->userId);
+ break;
+ case 'DELETE':
+ $response = $this->deleteUser($this->userId);
+ break;
+ default:
+ $response = $this->notFoundResponse();
+ break;*/
+ }
+
+ header($response['status_code_header']);
+ if ($response['body']) {
+ echo $response['body'];
+ }
+ }
+
+ private function unprocessableEntityResponse()
+ {
+ $response['status_code_header'] = 'HTTP/1.1 422 Unprocessable Entity';
+ $response['body'] = json_encode([
+ 'error' => 'Invalid input'
+ ]);
+ return $response;
+ }
+
+ private function notFoundResponse()
+ {
+ $response['status_code_header'] = 'HTTP/1.1 404 Not Found';
+ $response['body'] = null;
+ return $response;
+ }
+
+ private function methodNotAllowed()
+ {
+ $response['status_code_header'] = 'HTTP/1.1 405 Method Not Allowed';
+ $response['body'] = null;
+ return $response;
+ }
+
+ private function getData($time, $website)
+ {
+ $sd = (int)substr($time, 0, 2);
+ $ed = (int)substr($time, 8, 2);
+ $sm = (int)substr($time, 2, 2);
+ $em = (int)substr($time, 10, 2);
+ $sy = (int)substr($time, 4, 4);
+ $ey = (int)substr($time, 12, 4);
+
+ $this -> sites = json_decode(file_get_contents('./sites.json'),true);
+
+ if($sd!==null && $ed!==null && $sm!==null && $em!==null && $sy!==null && $ey!==null)
+ {
+ if($website !== 0)
+ {
+ if(gettype($website) == 'integer')
+ {
+ if($website > 0 && $website <= sizeof($this->sites['sites']))
+ $website = array($this->sites['sites'][$website - 1]);
+ else
+ return $this -> notFoundResponse();
+ }
+ else{
+ return $this -> notFoundResponse();
+ }
+ }
+ else{
+ $website = $this -> sites['sites'];
+ }
+
+ foreach ($website as $web)
+ {
+ $url = 'https://'.$web['domain'].'/data/awstats/awstats.php?sd='.$sd.'&ed='.$ed.'&sm='.$sm.'&em='.$em.'&sy='.$sy.'&ey='.$ey.'&web='.$web['domain'];
+ $contents = json_decode(file_get_contents($url));
+ $contents -> sno = $this -> sno;
+ $this -> sno += 1;
+ $contents -> awstats = $web['awstats'];
+ array_push($this -> result, $contents);
+ }
+
+ if (empty($this -> result)) {
+ return $this->notFoundResponse();
+ }
+
+// echo "Date: ".$sd.$sm.$sy.$ed.$em.$ey;
+ $response['status_code_header'] = 'HTTP/1.1 200 OK';
+ $response['body'] = json_encode($this -> result);
+ $response['dataType'] = 'json';
+ return $response;
+ }
+ }
+
+}
diff --git a/server/awstats.php b/server/awstats.php
new file mode 100644
index 0000000..24adcb8
--- /dev/null
+++ b/server/awstats.php
@@ -0,0 +1,171 @@
+Error()) die($aw->GetError());
+ $total_visit += $aw->GetVisits();
+ $unique_visit += $aw->GetUniqueVisits();
+
+ foreach ($aw->GetDays() as $day=>$stats)
+ {
+ $bandwidth += $stats[2];
+ $hits += $stats[1];
+ $page_loads += $stats[0];
+ }
+ }
+ }
+ }
+
+//$output = array('website' => $web, 'unique_visit' => $unique_visit, 'total_visit' => $total_visit, 'total_page_loads' => $page_loads, 'total_hits' => $hits, 'total_bandwidth' => $bandwidth);
+//echo json_encode($output);
+
+// Calculation for start month
+ $file = 'awstats/awstats'.$sm.$sy.'.'.$web.'.txt';
+ if($sm < 10){
+ $file = 'awstats/awstats0'.$sm.$sy.'.'.$web.'.txt';
+ }
+
+ if(file_exists($file)){
+ $aw = new awfile($file);
+ if ($aw->Error()) die($aw->GetError());
+// echo json_encode($aw->GetDays());
+ $unique_visit += $aw->GetUniqueVisits();
+ foreach ($aw->GetDays() as $day=>$stats)
+ {
+ if($day >= $sd)
+ {
+ $total_visit += $stats[3];
+ $bandwidth += $stats[2];
+ $hits += $stats[1];
+ $page_loads += $stats[0];
+ }
+ }
+ }
+
+//$output = array('website' => $web, 'unique_visit' => $unique_visit, 'total_visit' => $total_visit, 'total_page_loads' => $page_loads, 'total_hits' => $hits, 'total_bandwidth' => $bandwidth);
+//echo json_encode($output);
+
+
+// Calculation for end month
+ $file = 'awstats/awstats'.$em.$sy.'.'.$web.'.txt';
+ if($em < 10){
+ $file = 'awstats/awstats0'.$em.$sy.'.'.$web.'.txt';
+ }
+
+ if(file_exists($file)){
+ $aw = new awfile($file);
+ if ($aw->Error()) die($aw->GetError());
+ $unique_visit += $aw->GetUniqueVisits();
+ foreach ($aw->GetDays() as $day=>$stats)
+ {
+ if($day <= $ed)
+ {
+ $total_visit += $stats[3];
+ $bandwidth += $stats[2];
+ $hits += $stats[1];
+ $page_loads += $stats[0];
+ }
+ }
+ }
+
+
+
+ $output = array('website' => $web, 'unique_visit' => $unique_visit, 'total_visit' => $total_visit, 'total_page_loads' => $page_loads, 'total_hits' => $hits, 'total_bandwidth' => $bandwidth);
+// var_dump($output);
+ echo json_encode($output);
+ return $output;
+}
+
+data($startd, $endd, $startm, $endm, $starty, $endy, $website);
+
+/*
+ $aw = new awfile($file);
+ if ($aw->Error()) die($aw->GetError());
+
+ echo "Showing contents [".$file."]
";
+
+ echo "The site first visit in the month: ".$aw->GetFirstVisit()."
";
+ echo "Total visits this month: ".$aw->GetVisits()."
";
+ echo "Total unique visits this month: ".$aw->GetUniqueVisits()."
";
+ /*echo "Pages viewed / hours:
";
+ foreach ($aw->GetHours() as $hour=>$pages)
+ echo " ".str_pad($hour, 2, "0", STR_PAD_LEFT).": ".$pages." pages viewed.
";
+
+ echo "Pages viewed / days:
";
+ foreach ($aw->GetDays() as $day=>$pages)
+ echo " ".$day.": ".$pages." pages viewed.
";
+ echo "
";
+
+ $betterDay = $aw->GetBetterDay();
+ echo "The day with more visitors(".$betterDay[1].") was the ".$betterDay[0].".
";
+
+ echo "hits / os:
";
+ foreach ($aw->GetOs() as $os=>$hits)
+ echo " ".$os.": ".$hits." hits.
";
+ echo "
";
+
+ echo "hits / browser:
";
+ foreach ($aw->GetBrowser() as $browser=>$hits)
+ echo " ".$browser.": ".$hits." hits.
";
+ echo "
";
+
+ echo "Distinct Referers:
";
+ foreach ($aw->GetReferers() as $referer=>$hits)
+ echo " ".$referer.": ".$hits." hits.
";
+ echo "
";
+
+ echo "Visits / Session Ranges:
";
+ foreach ($aw->GetRanges() as $range=>$visits)
+ echo " ".$range.": ".$visits." visits.
";
+ echo "
";*/
+
+?>
diff --git a/server/class.awfile.php b/server/class.awfile.php
new file mode 100644
index 0000000..fbbb8d9
--- /dev/null
+++ b/server/class.awfile.php
@@ -0,0 +1,221 @@
+"file not found.",
+ 2=>"File not readable");
+ var $_positions = array(
+ "POS_GENERAL"=>0,
+ "POS_TIME"=>0,
+ "POS_OS"=>0,
+ "POS_BROWSER"=>0,
+ "POS_PAGEREFS"=>0,
+ "POS_DAY"=>0,
+ "POS_SESSION"=>0,
+ "POS_SIDER"=>0);
+
+ function awfile($fich) {
+ if (!file_exists($fich))
+ $this->error = 1;
+ else {
+ $this->fich = $fich;
+ $this->__proc();
+ }
+ }
+
+ function __proc() {
+ if (!$fd = fopen($this->fich,"r"))
+ $this->error = 2;
+ else {
+
+ do {
+ $str = trim(fgets($fd));
+ if ($str{0} ==" ") continue;
+
+ list($elem,$pos) = explode(" ",$str);
+ if (isset($this->_positions[$elem]))
+ $this->_positions[$elem] = $pos;
+ else continue;
+ } while ($str!="END_MAP");
+
+
+ fseek($fd,$this->_positions["POS_GENERAL"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ $pendientes = 3;
+ while ($n>0) {
+ list($elem,$num) = explode(" ",trim(fgets($fd)));
+ switch($elem) {
+ case "FirstTime":
+ $this->first_visit = $num;
+ $pendientes--;
+ break;
+ case "TotalVisits":
+ $this->visits = $num;
+ $pendientes--;
+ break;
+
+ case "TotalUnique":
+ $this->uniquevisits = $num;
+ $pendientes--;
+ break;
+ default: continue;
+ }
+ if ($pendientes==0) break;
+ $n--;
+ }
+
+ fseek($fd,$this->_positions["POS_TIME"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ while ($n>0) {
+ list($elem,$num,,,,,) = explode(" ",trim(fgets($fd)));
+ $this->aHours[$elem] = $num;
+ $n--;
+ }
+
+ fseek($fd,$this->_positions["POS_OS"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ while ($n>0) {
+ list($elem,$num) = explode(" ",trim(fgets($fd)));
+ $this->aOs[$elem] = $num;
+ $n--;
+ }
+
+ fseek($fd,$this->_positions["POS_BROWSER"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ while ($n>0) {
+ list($elem,$num) = explode(" ",trim(fgets($fd)));
+ $this->aBrowser[$elem] = $num;
+ $n--;
+ }
+
+ fseek($fd,$this->_positions["POS_PAGEREFS"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ while ($n>0) {
+ list($elem,$num,) = explode(" ",trim(fgets($fd)));
+ $this->aReferes[$elem] = $num;
+ $n--;
+ }
+
+ fseek($fd,$this->_positions["POS_DAY"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ while ($n>0) {
+ list($elem,$numpages,$hits,$bandwidth,$numvisits) = explode(" ",trim(fgets($fd)));
+ $this->aDays[(int)substr($elem,6,2)] = array($numpages, $hits, $bandwidth, $numvisits);
+ $n--;
+ }
+
+ fseek($fd,$this->_positions["POS_SESSION"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ while ($n>0) {
+ list($elem,$num) = explode(" ",trim(fgets($fd)));
+ $this->aRange[$elem] = $num;
+ $n--;
+ }
+
+ fseek($fd,$this->_positions["POS_SIDER"]);
+ list(,$n) = explode(" ",trim(fgets($fd)));
+ while ($n>0) {
+ list($elem,$num,,,) = explode(" ",trim(fgets($fd)));
+ $this->aSections[$elem] = $num;
+ $n--;
+ }
+
+ }
+
+ }
+
+
+ function GetFirstVisit() {
+ return $this->first_visit;
+ }
+
+ function GetVisits() {
+ return $this->visits;
+ }
+
+ function GetUniqueVisits() {
+ return $this->uniquevisits;
+ }
+
+ function GetHours() {
+ return $this->aHours;
+ }
+
+ function GetDays() {
+ return $this->aDays;
+ }
+
+ function GetOs() {
+ return $this->aOs;
+ }
+
+ function GetBrowser() {
+ return $this->aBrowser;
+ }
+
+ function GetReferers() {
+ return $this->aReferes;
+ }
+
+ function GetRanges() {
+ return $this->aRange;
+ }
+
+ function GetSections() {
+ return $this->aSections;
+ }
+
+ function Error() {
+ return $this->error;
+ }
+
+ function GetError() {
+ return $this->ErrorStr[$this->error];
+ }
+
+ function GetBetterDay() {
+ $max = 0;
+ foreach ($this->aDays as $day => $num) {
+ if ($num>$max) {
+ $max = $num;
+ $date = $day;
+ }
+ }
+ return array($date,$max);
+ }
+
+}
+
+?>
--
cgit