GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
Digital_Repository
Browse code
- Added link to MaxMind's GeoIP database.
master
1 parent
050dda6
commit
c1ce4b2d6648d034c70fb8e9b2f6b5bf7bfdef1a
nstanger
authored
on 12 Dec 2005
Patch
Showing
1 changed file
Repositories/statistics/includes/inc.html.cumulative_usage_country.es.php
Ignore Space
Show notes
View
Repositories/statistics/includes/inc.html.cumulative_usage_country.es.php
<?php require("inc.html.navbar_global.es.php"); ?> <h3>Abstract views and document downloads by country (derived from IP address of query)</h3> <p><strong>Note:</strong> The country of origin is determined by looking up the source IP address in the <a href="http://www.maxmind.com/app/geoip_country">GeoLite Free Country</a> database provided by MaxMind LLC. Due to the ever-changing nature of the Internet, this database can never be 100% complete or accurate, so a small number of downloads may be reported as being from the wrong country.</p> <?php $max_width=500; if (! isset($GLOBALS["db_values"]["0"]["country_downloads"])) { print "<table>\n"; print '<tr><td align="left" width="200" style="color:#ff0000;"><b>No statistics available.</b></td></tr>'; print "\n"; } else { // Compute the longest bar $max_count = $GLOBALS["db_values"]["0"]["country_downloads"]; for ($rs=0; $rs<count($GLOBALS["db_values"]); $rs++) { if ($GLOBALS["db_values"][$rs]["country_abstracts"] > $max_count) { $max_count = $GLOBALS["db_values"][$rs]["country_abstracts"]; } } print "<table>\n"; print '<tr><th colspan="2" align="left" style="background-color:#cccccc;">Country</th> <th style="background-color:#66ddee;">Abstracts</th> <th style="background-color:#4477dd;color:#ffffff;">Downloads</th> <th style="background-color:#cccccc;"> </th></tr>'; for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++) { if ($GLOBALS["db_values"][$rs]["country_name"]=='') { $GLOBALS["db_values"][$rs]["country_name"]='unknown'; } if ($GLOBALS["db_values"][$rs]["country_name"]=='N/A') { $GLOBALS["db_values"][$rs]["country_name"]='unknown'; } print '<tr><td>'; // select a flag $ccode = strtolower($GLOBALS["db_values"][$rs]["country_code"]); $c_flag = 'flags18x14/' . $ccode . '.png'; if (file_exists($c_flag)) { print '<img src="'. $c_flag . '" width="18" height="14" alt="'. $ccode . '">'; } else { print '<img src="flags18x14/unknown.png" width="18" height="14" alt="' . $ccode . '">'; }; print '</td><td style="font-size:small;">' . $GLOBALS["db_values"][$rs]["country_name"]. '</td><td align="right" style="font-size:small;">'. $GLOBALS["db_values"][$rs]["country_abstracts"]. '</td><td align="right" style="font-size:small;">' . $GLOBALS["db_values"][$rs]["country_downloads"]. '</td>'; $cur_count = $GLOBALS["db_values"][$rs]["country_abstracts"]; $col_width = (int) ($cur_count/$max_count * $max_width); $col_width = max($col_width,1); $col_width .= "px"; print '<td align="left"><img src="bars/hh.png" alt="views" height="9" width="'. $col_width . '"><br />'; $cur_count = $GLOBALS["db_values"][$rs]["country_downloads"]; $col_width = (int) ($cur_count/$max_count * $max_width); $col_width = max($col_width,1); $col_width .= "px"; print '<img src="bars/hp.png" alt="views" height="9" width="'. $col_width . '"></td></tr>'; } } // of else print "</table>\n"; ?>
<?php require("inc.html.navbar_global.es.php"); ?> <h3>Abstract views and document downloads by country (derived from IP address of query)</h3> <p><strong>Note:</strong> The country of origin is determined by matching the source IP address against a database of known IP address ranges. Due to the ever-changing nature of the Internet, this database can never be 100% complete or accurate, so a small number of downloads may be reported as being from the wrong country. The list of countries displayed below should therefore be considered indicative rather than definitive.</p> <?php $max_width=500; if (! isset($GLOBALS["db_values"]["0"]["country_downloads"])) { print "<table>\n"; print '<tr><td align="left" width="200" style="color:#ff0000;"><b>No statistics available.</b></td></tr>'; print "\n"; } else { // Compute the longest bar $max_count = $GLOBALS["db_values"]["0"]["country_downloads"]; for ($rs=0; $rs<count($GLOBALS["db_values"]); $rs++) { if ($GLOBALS["db_values"][$rs]["country_abstracts"] > $max_count) { $max_count = $GLOBALS["db_values"][$rs]["country_abstracts"]; } } print "<table>\n"; print '<tr><th colspan="2" align="left" style="background-color:#cccccc;">Country</th> <th style="background-color:#66ddee;">Abstracts</th> <th style="background-color:#4477dd;color:#ffffff;">Downloads</th> <th style="background-color:#cccccc;"> </th></tr>'; for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++) { if ($GLOBALS["db_values"][$rs]["country_name"]=='') { $GLOBALS["db_values"][$rs]["country_name"]='unknown'; } if ($GLOBALS["db_values"][$rs]["country_name"]=='N/A') { $GLOBALS["db_values"][$rs]["country_name"]='unknown'; } print '<tr><td>'; // select a flag $ccode = strtolower($GLOBALS["db_values"][$rs]["country_code"]); $c_flag = 'flags18x14/' . $ccode . '.png'; if (file_exists($c_flag)) { print '<img src="'. $c_flag . '" width="18" height="14" alt="'. $ccode . '">'; } else { print '<img src="flags18x14/unknown.png" width="18" height="14" alt="' . $ccode . '">'; }; print '</td><td style="font-size:small;">' . $GLOBALS["db_values"][$rs]["country_name"]. '</td><td align="right" style="font-size:small;">'. $GLOBALS["db_values"][$rs]["country_abstracts"]. '</td><td align="right" style="font-size:small;">' . $GLOBALS["db_values"][$rs]["country_downloads"]. '</td>'; $cur_count = $GLOBALS["db_values"][$rs]["country_abstracts"]; $col_width = (int) ($cur_count/$max_count * $max_width); $col_width = max($col_width,1); $col_width .= "px"; print '<td align="left"><img src="bars/hh.png" alt="views" height="9" width="'. $col_width . '"><br />'; $cur_count = $GLOBALS["db_values"][$rs]["country_downloads"]; $col_width = (int) ($cur_count/$max_count * $max_width); $col_width = max($col_width,1); $col_width .= "px"; print '<img src="bars/hp.png" alt="views" height="9" width="'. $col_width . '"></td></tr>'; } } // of else print "</table>\n"; ?>
Show line notes below