summaryrefslogtreecommitdiffstats
path: root/lib/class/user.class.php
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-28 11:09:49 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-03-28 16:56:21 -0400
commit744e6bb99404b8455024488472a1ad02e5c87025 (patch)
tree02b23c011984d5a25e762f015568585a9cb8409f /lib/class/user.class.php
parenteee48871e9071db686b1db89786da2968a8857cf (diff)
downloadampache-744e6bb99404b8455024488472a1ad02e5c87025.tar.gz
ampache-744e6bb99404b8455024488472a1ad02e5c87025.tar.bz2
ampache-744e6bb99404b8455024488472a1ad02e5c87025.zip
Make remote catalogs actually work
Diffstat (limited to 'lib/class/user.class.php')
-rw-r--r--lib/class/user.class.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 56ed97bc..a9d96506 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -69,6 +69,27 @@ class User extends database_object {
} // Constructor
/**
+ * count
+ *
+ * This returns the number of user accounts that exist.
+ */
+ public function count() {
+ $sql = 'SELECT COUNT(`id`) FROM `user`';
+ $db_results = Dba::read($sql);
+ $data = Dba::fetch_row($db_results);
+ $results['users'] = $data[0];
+
+ $time = time();
+ $last_seen = $time - 1200;
+ $sql = 'SELECT COUNT(DISTINCT `session`.`username) FROM `session` ' .
+ 'INNER JOIN `user` ON `session`.`username` = `user`.`username` ' .
+ 'WHERE `session`.`expire` > ? and `user`.`last_seen` > ?';
+ $db_results = Dba::read($sql, array($time, $last_seen));
+ $data = Dba::fetch_row($db_results);
+ $results['connected'] = $data[0];
+ }
+
+ /**
* _get_info
* This function returns the information for this object
*/