@@ -49,9 +49,11 @@ function array_key_last($array) {
4949 $ top_countries [$ country [0 ]] = $ country [1 ];
5050 $ continent = $ country_to_continent [strtoupper ($ country [0 ])];
5151 if (!array_key_exists ($ continent , $ top_continents )) {
52+ $ top_continents [$ continent ] = $ country [1 ];
5253 $ total_continents = $ total_continents + 1 ;
54+ } else {
55+ $ top_continents [$ continent ] = $ top_continents [$ continent ] + $ country [1 ];
5356 }
54- $ top_continents [$ continent ] = $ top_continents [$ continent ] + $ country [1 ];
5557 } else {
5658 $ top_countries ["? " ] = $ country [1 ];
5759 $ top_continents ["? " ] = $ country [1 ];
@@ -62,17 +64,25 @@ function array_key_last($array) {
6264arsort ($ top_continents );
6365$ total_countries = 0 ;
6466$ top_countriesvo = array ();
67+ $ top_continentsvo = array ();
6568foreach ($ web_analytics_db ->query ("SELECT `country`, COUNT(*) FROM wa_browsers GROUP BY `country` ORDER BY COUNT(*) DESC; " ) as $ country ) {
6669 if ($ country [0 ] != "" && $ country [0 ] != null ) {
6770 $ top_countriesvo [$ country [0 ]] = $ country [1 ];
71+ $ continent = $ country_to_continent [strtoupper ($ country [0 ])];
72+ if (!array_key_exists ($ continent , $ top_continentsvo )) {
73+ $ top_continentsvo [$ continent ] = $ country [1 ];
74+ } else {
75+ $ top_continentsvo [$ continent ] = $ top_continentsvo [$ continent ] + $ country [1 ];
76+ }
6877 $ total_countries = $ total_countries + 1 ;
6978 } else {
7079 $ top_countriesvo ["? " ] = $ country [1 ];
7180 }
7281}
82+ $ top_originsvo = array_merge ($ top_countriesvo , $ top_continentsvo );
7383$ top_languages = array ();
7484$ total_languages = 0 ;
75- foreach ($ tplngsr = $ web_analytics_db ->query ("SELECT `language`, COUNT(*) FROM wa_browsers GROUP BY `language` ORDER BY COUNT(*) DESC; " ) as $ language ) {
85+ foreach ($ web_analytics_db ->query ("SELECT `language`, COUNT(*) FROM wa_browsers GROUP BY `language` ORDER BY COUNT(*) DESC; " ) as $ language ) {
7686 if ($ language [0 ] != "" && $ language [0 ] != null ) {
7787 $ top_languages [$ language [0 ]] = $ language [1 ];
7888 $ total_languages = $ total_languages + 1 ;
@@ -404,10 +414,10 @@ function drawobyrChart() {
404414 $ i = 0 ;
405415 foreach ($ top_origins as $ key => $ value ) {
406416 if ($ i == 0 ) {
407- echo "[' " .$ key ."', " .$ value .", " .$ top_countriesvo [$ key ]."] " ;
417+ echo "[' " .$ key ."', " .$ value .", " .$ top_originsvo [$ key ]."] " ;
408418 $ i ++;
409419 } else {
410- echo ",[' " .$ key ."', " .$ value .", " .$ top_countriesvo [$ key ]."] " ;
420+ echo ",[' " .$ key ."', " .$ value .", " .$ top_originsvo [$ key ]."] " ;
411421 }
412422 }
413423 ?>
0 commit comments