Get the number of active sessions - sessions that have not expired.

@return integer     Returns the number of active (not expired) sessions.
357668
public function get_active_sessions()
    {

        // call the garbage collector
        $this->gc();

        // counts the rows from the database
        $result = @mysqli_fetch_assoc($this->_mysql_query('

            SELECT
                COUNT(session_id) as count
            FROM ' . $this->table_name . '

        ')) or die(_mysql_error());

        // return the number of found rows
        return $result['count'];

    }
669212
public function count()
    {
        if ($this->isInitialized()) {
            return $this->collection->count();
        }

        // Return cached result in case count query was already executed
        if ($this->count !== null) {
            return $this->count;
        }

        return $this->count = $this->entityPersister->count($this->criteria);
    }
979705
public static function getActive()
    {
        $app = Facade::getFacadeApplication();
        $db = $app->make('database')->connection();
        $sclHandle = $db->fetchColumn('select sclHandle from SystemCaptchaLibraries where sclIsActive = 1');

        return ($sclHandle === false) ? null : static::getByHandle($sclHandle);
    }
655005
public function getUserLoginStatus()
    {
        $status = $this->getSessionData(self::SESSION_ID_USER_LOGIN_STATUS);
        if (isset($status) && $status === TRUE) {
            return TRUE;
        } else {
            return FALSE;
        }
    }
808286
public function getStatus() {
		if (isset($_SESSION) && isset($_SESSION[self::SESSION_FIELD_STATUS])) {
			return $_SESSION[self::SESSION_FIELD_STATUS];
		}
		else {
			return null;
		}
	}
1064185
public function count()
    {
        if (isset($this->_resultset)) {
            return $this->_resultset->count();
        } elseif (isset($this->_limit) || isset($this->_group)) {
            return $this->execute()->count();
        } else {
            $query = clone $this;

            return (int)$query->select("count(*) count")->execute()->scalar();
        }
    }
305875
public function active()
    {
        $stats = $this->root()->stats();
        return $this->root()->focused() ? $stats['focused'] : $stats['normal'];
    }
304344
public function getActiveStateFromChilds()
    {
        foreach ($this->getChilds() as $child) {
            if ($child->inactive()) {
                return false;
            } elseif ($child->isActive()) {
                return true;
            } elseif ($child->hasRoute() && $child->getActiveStateFromRoute()) {
                return true;
            } elseif ($child->getActiveStateFromUrl()) {
                return true;
            }
        }

        return false;
    }
1071735
public function getCurrentSessionUserInfo()
    {
        $ts = $this->config->table_sessions;
        $tu = $this->config->table_users;

        $query = "
		SELECT {$ts}.uid, {$ts}.expiredate, {$ts}.ip, {$tu}.email, {$tu}.username
		FROM {$ts}, {$tu}
		WHERE hash = :hash AND {$ts}.uid = {$tu}.id";

        $query = $this->dbh->prepare($query);
        $query->execute([
            'hash'	=>	$this->getCurrentSessionHash()
        ]);

        if ($query->rowCount() == 0) {
            return false;
        }

        return $query->fetch(\PDO::FETCH_ASSOC);
    }
385635
public function count()
    {
        if ($this->numberOfRows === null) {
            if (is_array($this->rows)) {
                $this->numberOfRows = count($this->rows);
            } else {
                $this->numberOfRows = $this->query->count();
            }
        }
        return $this->numberOfRows;
    }
660711
public function isActive()
	{
		$time = time();
		$active = ($this->active && ($this->activationStart == '' || $this->activationStart < $time) && ($this->activationStop == '' || $this->activationStop > $time));
		return $active;
	}
989471
public static function getCurrent()
    {
        if (empty(self::$current)) {
            Logger::get()->debug('Checking session for users...');
            self::$current = static::getInstance()->getFromSession();

            // Nothing there, new visitor then.
            if (empty(self::$current)) {
                throw new \RuntimeException('Unable to obtain a user');
            }

            // Update last seen time.
            self::$current->lastSeen = new \DateTime;

            Logger::get()->debug(
                'Current user is ' . self::$current->getId()
            );
        }

        return self::$current;
    }
1228585
public static function get()
	{
		self::checkSessionStarted();

		$res = array();
		if (isset($_SESSION[self::$sessionName]))
		{
			$res = $_SESSION[self::$sessionName];
			unset($_SESSION[self::$sessionName]);
		}

		return $res;
	}
738594
public function current()
    {
        return (($this->rows_count != null && $this->rows_count > 0 ) || !$this->isEmpty())
            ? $this->get($this->position)
            : null
            ;
    }
437756
public function getCount()
    {
        if ($this->_count !== null) {
            return $this->_count;
        }

        while ($this->_hasMore) {
            $this->fetchOutstanding();
        }

        return $this->_length;
    }
23072
public function collectGarbage()
    {

        // counter to store the number of removed sessions
        $sessionRemovalCount = 0;

        // prepare the expression to select the session files
        $globExpression = sprintf('%s*', $this->getSessionSavePath($this->getSessionSettings()->getSessionFilePrefix()));

        // iterate over the found session files
        foreach (glob($globExpression) as $pathname) {
            // unpersist the session
            $session = $this->unpersist($pathname);

            // query whether or not the session has been expired
            if ($this->sessionTimedOut($session)) {
                // if yes, delete the session + raise the session removal count
                $this->delete($session->getId());
                $sessionRemovalCount++;
            }
        }

        // return the number of removed sessions
        return $sessionRemovalCount;
    }
200830
public function getActiveFrom()
    {
        return ! empty($value = $this->getContentValue('active_from', null))
            ? $this->convertToCarbon($value)
            : null;
    }