git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

stats.php 2 KB
Newer Older
mattl's avatar
mattl committed
1 2 3 4
<?php

/* GNUkebox -- a free software server for recording your listening habits

mattl's avatar
mattl committed
5
   Copyright (C) 2009, 2016 Free Software Foundation, Inc
mattl's avatar
mattl committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Affero General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Affero General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

header('Content-type: text/html; charset=utf-8');
require_once('database.php');
24 25
require_once('utils/human-time.php');
require_once('temp-utils.php');
mattl's avatar
mattl committed
26 27 28 29 30 31 32 33 34

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Statistics</title>
</head>
<body>
mattl's avatar
mattl committed
35
		<h1><a href="/">GNUkebox</a> Statistics</h1>
mattl's avatar
mattl committed
36

mattl's avatar
mattl committed
37 38
		<p>Please note, results are cached for approximately 9 minutes.</p>

mattl's avatar
mattl committed
39 40
		<?php
			$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
41
			$total = $adodb->CacheGetOne(500, 'SELECT SUM(scrobble_count) as total from User_Stats');
42 43
			if (!$total) {
				die('sql error');
mattl's avatar
mattl committed
44
			}
45
			echo '<p>' . stripslashes($total) . ' listens.</p>';
mattl's avatar
mattl committed
46

mattl's avatar
mattl committed
47
			$total = $adodb->CacheGetOne(500, 'SELECT COUNT(*) as total from Track');
48 49
			if (!$total) {
				die('sql error');
mattl's avatar
mattl committed
50
			}
51
			echo '<p>' . stripslashes($total) . ' unique tracks.</p>';
mattl's avatar
mattl committed
52

mattl's avatar
mattl committed
53
			$total = $adodb->CacheGetOne(500, 'SELECT COUNT(*) as total from Users');
54 55
			if (!$total) {
				die('sql error');
mattl's avatar
mattl committed
56
			}
57
			echo '<p>' . stripslashes($total) . ' users.</p>';
mattl's avatar
mattl committed
58
			
Matt Lee's avatar
Matt Lee committed
59
			$total = $adodb->CacheGetOne(500, 'SELECT COUNT(*) as total from User_Stats');
mattl's avatar
mattl committed
60 61 62 63
			if (!$total) {
				die('sql error');
			}
			echo '<p>' . stripslashes($total) . ' users active.</p>';
mattl's avatar
mattl committed
64 65 66

		?>
</body>
67
</html>