Skip to content
This repository was archived by the owner on Apr 9, 2023. It is now read-only.

Commit e562661

Browse files
committed
Bugfix and minor improvements
1 parent e100abb commit e562661

File tree

3 files changed

+53
-52
lines changed

3 files changed

+53
-52
lines changed

analyser.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function country_to_continent($country) {
5858
$country_to_continent = array ("AD"=>"EU","AE"=>"AS","AF"=>"AS","AG"=>"NA","AI"=>"NA","AL"=>"EU","AM"=>"AS","AN"=>"NA","AO"=>"AF","AP"=>"AS","AR"=>"SA","AS"=>"OC","AT"=>"EU","AU"=>"OC","AW"=>"NA","AX"=>"EU","AZ"=>"AS","BA"=>"EU","BB"=>"NA","BD"=>"AS","BE"=>"EU","BF"=>"AF","BG"=>"EU","BH"=>"AS","BI"=>"AF","BJ"=>"AF","BL"=>"NA","BM"=>"NA","BN"=>"AS","BO"=>"SA","BR"=>"SA","BS"=>"NA","BT"=>"AS","BV"=>"AN","BW"=>"AF","BY"=>"EU","BZ"=>"NA","CA"=>"NA","CC"=>"AS","CD"=>"AF","CF"=>"AF","CG"=>"AF","CH"=>"EU","CI"=>"AF","CK"=>"OC","CL"=>"SA","CM"=>"AF","CN"=>"AS","CO"=>"SA","CR" => "NA","CU"=>"NA","CV"=>"AF","CX"=>"AS","CY"=>"AS","CZ"=>"EU","DE"=>"EU","DJ"=>"AF","DK"=>"EU","DM"=>"NA","DO"=>"NA","DZ"=>"AF","EC"=>"SA","EE"=>"EU","EG"=>"AF","EH"=>"AF","ER"=>"AF","ES"=>"EU","ET"=>"AF","EU"=>"EU","FI"=>"EU","FJ"=>"OC","FK"=>"SA","FM"=>"OC","FO"=>"EU","FR"=>"EU","FX"=>"EU","GA"=>"AF","GB"=>"EU","GD"=>"NA","GE"=>"AS","GF"=>"SA","GG"=>"EU","GH"=>"AF","GI"=>"EU","GL"=>"NA","GM"=>"AF","GN"=>"AF","GP"=>"NA","GQ"=>"AF","GR"=>"EU","GS"=>"AN","GT"=>"NA","GU"=>"OC","GW"=>"AF","GY"=>"SA","HK"=>"AS","HM"=>"AN","HN"=>"NA","HR"=>"EU","HT"=>"NA","HU"=>"EU","ID"=>"AS","IE"=>"EU","IL"=>"AS","IM"=>"EU","IN"=>"AS","IO"=>"AS","IQ"=>"AS","IR"=>"AS","IS"=>"EU","IT"=>"EU","JE"=>"EU","JM"=>"NA","JO"=>"AS","JP"=>"AS","KE"=>"AF","KG"=>"AS","KH"=>"AS","KI"=>"OC","KM"=>"AF","KN"=>"NA","KP"=>"AS","KR"=>"AS","KW"=>"AS","KY"=>"NA","KZ"=>"AS","LA"=>"AS","LB"=>"AS","LC"=>"NA","LI"=>"EU","LK"=>"AS","LR"=>"AF","LS"=>"AF","LT"=>"EU","LU"=>"EU","LV"=>"EU","LY"=>"AF","MA"=>"AF","MC"=>"EU","MD"=>"EU","ME"=>"EU","MF"=>"NA","MG"=>"AF","MH"=>"OC","MK"=>"EU","ML"=>"AF","MM"=>"AS","MN"=>"AS","MO"=>"AS","MP"=>"OC","MQ"=>"NA","MR"=>"AF","MS"=>"NA","MT"=>"EU","MU"=>"AF","MV"=>"AS","MW"=>"AF","MX"=>"NA","MY"=>"AS","MZ"=>"AF","NA"=>"AF","NC"=>"OC","NE"=>"AF","NF"=>"OC","NG"=>"AF","NI"=>"NA","NL"=>"EU","NO"=>"EU","NP"=>"AS","NR"=>"OC","NU"=>"OC","NZ"=>"OC","OM"=>"AS","PA"=>"NA","PE"=>"SA","PF"=>"OC","PG"=>"OC","PH"=>"AS","PK"=>"AS","PL"=>"EU","PM"=>"NA","PN"=>"OC","PR"=>"NA","PS"=>"AS","PT"=>"EU","PW"=>"OC","PY"=>"SA","QA"=>"AS","RE"=>"AF","RO"=>"EU","RS"=>"EU","RU"=>"EU","RW"=>"AF","SA"=>"AS","SB"=>"OC","SC"=>"AF","SD"=>"AF","SE"=>"EU","SG"=>"AS","SH"=>"AF","SI"=>"EU","SJ"=>"EU","SK"=>"EU","SL"=>"AF","SM"=>"EU","SN"=>"AF","SO"=>"AF","SR"=>"SA","ST"=>"AF","SV"=>"NA","SY"=>"AS","SZ"=>"AF","TC"=>"NA","TD"=>"AF","TF"=>"AN","TG"=>"AF","TH"=>"AS","TJ"=>"AS","TK"=>"OC","TL"=>"AS","TM"=>"AS","TN"=>"AF","TO"=>"OC","TR"=>"EU","TT"=>"NA","TV"=>"OC","TW"=>"AS","TZ"=>"AF","UA"=>"EU","UG"=>"AF","UM"=>"OC","US"=>"NA","UY"=>"SA","UZ"=>"AS","VA"=>"EU","VC"=>"NA","VE"=>"SA","VG"=>"NA","VI"=>"NA","VN"=>"AS","VU"=>"OC","WF"=>"OC","WS"=>"OC","YE"=>"AS","YT"=>"AF","ZA"=>"AF","ZM"=>"AF","ZW"=>"AF");
5959
return $country_to_continent[strtoupper($country)];
6060
}
61-
function get_tops($mysql, $table, $field, $start = null, $end = null, $timefield = "created") {
61+
function get_tops($mysql, $table, $field, $start = null, $end = null, $timefield = "time") {
6262
$tops = array();
6363
$rows = null;
6464
if($start == null && $end == null) {
@@ -73,7 +73,7 @@ function get_tops($mysql, $table, $field, $start = null, $end = null, $timefield
7373
}
7474
return $tops;
7575
}
76-
function get_total_count($mysql, $table, $start = null, $end = null, $timefield = "created") {
76+
function get_total_count($mysql, $table, $start = null, $end = null, $timefield = "time") {
7777
$row = null;
7878
if($start == null && $end == null) {
7979
$row = $this->get_one_row("SELECT COUNT(*) FROM ".$table.";", $mysql);
@@ -84,7 +84,7 @@ function get_total_count($mysql, $table, $start = null, $end = null, $timefield
8484
}
8585
return $row[0];
8686
}
87-
function analyse_countries($mysql, $table, $field, $start = null, $end = null, $timefield = "created") {
87+
function analyse_countries($mysql, $table, $field, $start = null, $end = null, $timefield = "time") {
8888
$total_countries = 0;
8989
$rows = null;
9090
if($start == null && $end == null) {
@@ -129,12 +129,12 @@ function analyse_time($mysql, $time = null) {
129129
}
130130
}
131131
$total_requests = $this->get_total_count($mysql, "requests", $start, $end);
132-
$total_visitors = $this->get_total_count($mysql, "visitors", $start, $end);
132+
$total_visitors = $this->get_total_count($mysql, "browsers", $start, $end);
133133
$total_isps = $this->get_total_count($mysql, "isps", $start, $end);
134134
$total_networks = $this->get_total_count($mysql, "networks", $start, $end);
135-
$total_useragents = $this->get_total_count($mysql, "useragents", $start, $end);
135+
$total_useragents = $this->get_total_count($mysql, "agents", $start, $end);
136136
$top_requests = $this->analyse_countries($mysql, "requests", "visitor_country", $start, $end);
137-
$top_visitors = $this->analyse_countries($mysql, "uniquebrowsers", "country", $start, $end);
137+
$top_visitors = $this->analyse_countries($mysql, "browsers", "country", $start, $end);
138138
$top_requests["uris"] = $this->get_tops($mysql, "requests", "uri", $start, $end);
139139
$timespan = array("total_requests" => $total_requests, "total_visitors" => $total_visitors, "total_isps" => $total_isps, "total_networks" => $total_networks, "total_useragents" => $total_useragents, "top_requests" => $top_requests, "top_visitors" => $top_visitors);
140140
return $timespan;

0 commit comments

Comments
 (0)