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

Commit 6f6ace9

Browse files
committed
Minor improvements and security patch
1 parent cb37f97 commit 6f6ace9

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

webanalytics.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,17 +457,17 @@ function get_profile() {
457457
"java_enabled" => "VARCHAR(5)"
458458
));
459459
if(isset($this->c["device_profile"]) && isset($this->c["browser_profile"])) {
460-
$profile = array();
461-
$profile["id"] = $this->db_manager->generate_id();
462-
$profile = array_merge(array("id" => $this->db_manager->generate_id()), json_decode($this->c["device_profile"], true), json_decode($this->c["browser_profile"], true));
460+
$c_profile = array_merge(json_decode($this->c["device_profile"], true), json_decode($this->c["browser_profile"], true));
463461
$search_keys = array("screen_width", "screen_height", "interface_width", "interface_height", "color_depth", "pixel_depth", "cookies_enabled", "java_enabled");
464462
$search_query = "";
465463
$search_count = 0;
464+
$profile = array("id" => $this->db_manager->generate_id());
466465
foreach ($search_keys as $key) {
467466
if($search_count != 0) {
468467
$search_query .= " AND ";
469468
}
470-
if(isset($profile[$key]) && $profile[$key] != null) {
469+
if(isset($c_profile[$key]) && $c_profile[$key] != null) {
470+
$profile[$key] = $c_profile[$key];
471471
$search_query .= "".$key." = '".strval($profile[$key])."'";
472472
} else {
473473
$search_query .= "".$key." IS NULL";

webstatistics.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@
3333
$total_visitors = $web_analytics_db->count("wa_browsers");
3434
$total_networks = $web_analytics_db->count("wa_networks");
3535
$total_isps = $web_analytics_db->count("wa_isps");
36-
$mstrqstsr = $web_analytics_db->get_rows_array("SELECT `visitor_country`, COUNT(*) FROM wa_requests GROUP BY `visitor_country` ORDER BY COUNT(*) DESC;");
3736
$top_countries = array();
3837
$top_continents = array();
3938
$total_continents = 0;
40-
foreach($mstrqstsr as $country) {
39+
foreach($web_analytics_db->query("SELECT `visitor_country`, COUNT(*) FROM wa_requests GROUP BY `visitor_country` ORDER BY COUNT(*) DESC;") as $country) {
4140
if($country[0] != "" && $country[0] != null) {
4241
$top_countries[$country[0]] = $country[1];
4342
$continent = $country_to_continent[strtoupper($country[0])];
@@ -52,40 +51,35 @@
5251
}
5352
arsort($top_continents);
5453
$total_countries = 0;
55-
$tpvstrsor = $web_analytics_db->get_rows_array("SELECT `country`, COUNT(*) FROM wa_browsers GROUP BY `country` ORDER BY COUNT(*) DESC;");
5654
$top_countriesvo = array();
57-
foreach($tpvstrsor as $country) {
55+
foreach($web_analytics_db->query("SELECT `country`, COUNT(*) FROM wa_browsers GROUP BY `country` ORDER BY COUNT(*) DESC;") as $country) {
5856
if($country[0] != "" && $country[0] != null) {
5957
$top_countriesvo[$country[0]] = $country[1];
6058
$total_countries = $total_countries + 1;
6159
} else {
6260
$top_countriesvo["?"] = $country[1];
6361
}
6462
}
65-
$tplngsr = $web_analytics_db->get_rows_array("SELECT `language`, COUNT(*) FROM wa_browsers GROUP BY `language` ORDER BY COUNT(*) DESC;");
6663
$top_languages = array();
6764
$total_languages = 0;
68-
foreach($tplngsr as $language) {
65+
foreach($tplngsr = $web_analytics_db->query("SELECT `language`, COUNT(*) FROM wa_browsers GROUP BY `language` ORDER BY COUNT(*) DESC;") as $language) {
6966
if($language != "" && $language != null) {
7067
$top_languages[$language[0]] = $language[1];
7168
$total_languages = $total_languages + 1;
7269
} else {
7370
$top_languages["?"] = $language[1];
7471
}
7572
}
76-
$tpusragntsr = $web_analytics_db->get_rows_array("SELECT `agent_id`, COUNT(*) FROM wa_browsers GROUP BY `agent_id` ORDER BY COUNT(*) DESC;");
7773
$top_useragents = array();
78-
foreach($tpusragntsr as $useragent) {
74+
foreach($web_analytics_db->query("SELECT `agent_id`, COUNT(*) FROM wa_browsers GROUP BY `agent_id` ORDER BY COUNT(*) DESC;") as $useragent) {
7975
$top_useragents[$useragent[0]] = $useragent[1];
8076
}
81-
$tpispsr = $web_analytics_db->get_rows_array("SELECT `isp_id`, COUNT(*) FROM wa_networks GROUP BY `isp_id` ORDER BY COUNT(*) DESC;");
8277
$top_isps = array();
83-
foreach($tpispsr as $isp) {
78+
foreach($web_analytics_db->query("SELECT `isp_id`, COUNT(*) FROM wa_networks GROUP BY `isp_id` ORDER BY COUNT(*) DESC;") as $isp) {
8479
$top_isps[$isp[0]] = $isp[1];
8580
}
86-
$tpurir = $web_analytics_db->get_rows_array("SELECT `uri`, COUNT(*) FROM wa_requests GROUP BY `uri` ORDER BY COUNT(*) DESC;");
8781
$top_uris = array();
88-
foreach($tpurir as $uri) {
82+
foreach($web_analytics_db->query("SELECT `uri`, COUNT(*) FROM wa_requests GROUP BY `uri` ORDER BY COUNT(*) DESC;") as $uri) {
8983
$top_uris[$uri[0]] = $uri[1];
9084
}
9185
?>

0 commit comments

Comments
 (0)