summaryrefslogtreecommitdiff
path: root/versions.php
diff options
context:
space:
mode:
Diffstat (limited to 'versions.php')
-rw-r--r--versions.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/versions.php b/versions.php
index 3b2729de..c805f77e 100644
--- a/versions.php
+++ b/versions.php
@@ -1,19 +1,25 @@
<?php
-$versions = file('versions.txt');
+$file = 'versions/' . date('Y-m-d') . '.txt';
+if (!file_exists($file)) touch($file); // Make sure it exists
+
+$versions = file($file);
$verinfo = array();
-foreach($versions as $ver) {
- if ($verinfo[$ver] != null) {
- $verinfo[$ver]++;
- } else {
- $verinfo[$ver] = 1;
- }
+foreach($versions as $version) {
+ $ver = substr($version, 8); // Ignore time information
+ if ($verinfo[$ver] != null) {
+ $verinfo[$ver]++;
+ } else {
+ $verinfo[$ver] = 1;
+ }
}
+
arsort($verinfo);
+
$total = count($versions);
-echo '<table border="1px" cellspacing="0px"><tr><th>Client</th><th>No.</th><th>%</th></tr>';
+print '<table border="1px" cellspacing="0px" cellpadding="1px"><tr><th>Client</th><th title="Count">n</th><th title="Percent of total">%</th></tr>';
foreach($verinfo as $vi=>$vc) {
- echo '<tr><td>' . $vi . '</td><td>' . $vc . '</td><td>' . round((100/$total)*$vc,2) . '</td></tr>';
+ echo '<tr><td>' . $vi . '</td><td>' . $vc . '</td><td>' . round((100 / $total) * $vc, 2) . '</td></tr>';
}
-echo '</table><br />Total number of connections: ' . $total . '<br />Number of different clients reported: '
- . count($verinfo) . '<br /><br />Data retrieved: ' . date('D M d y, g:i a T', filemtime('versions.txt'));
+print '</table><br />Total number of connections: ' . $total . '<br />Number of different clients reported: '
+ . count($verinfo) . '<br /><br />Data retrieved: ' . date('D M d y, g:i a T', filemtime($file));
?> \ No newline at end of file