function sess_count in Drupal for Facebook 6.2
Counts how many users have sessions. Can count either anonymous sessions or authenticated sessions.
Parameters
int $timestamp: A Unix timestamp representing a point of time in the past. The default is 0, which counts all existing sessions.
boolean $anonymous: TRUE counts only anonymous users. FALSE counts only authenticated users.
Return value
int The number of users with sessions.
File
- ./
fb_session_impl.inc, line 101 - Re-write of Drupal's session.inc, for facebook-controlled sessions.
Code
function sess_count($timestamp = 0, $anonymous = TRUE) {
$query = $anonymous ? ' AND uid = 0' : ' AND uid > 0';
return db_result(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d' . $query, $timestamp));
}