Actions

API16

JTableSession/exists

From Joomla! Documentation

< API16:JTableSession
Revision as of 17:42, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Find out if a user has a one or more active sessions

[Edit Descripton]

Description:JTableSession/exists

Syntax

exists($userid)
Parameter Name Default Value Description
$userid $userid The identifier of the user

Returns

boolean True if a session for this user exists

Defined in

libraries/joomla/database/table/session.php

Importing

jimport( 'joomla.database.table.session' );

Source Body

function exists($userid)
{
        $query = 'SELECT COUNT(userid) FROM #__session'
                . ' WHERE userid = '. $this->_db->Quote($userid);
        $this->_db->setQuery($query);
 
        if (!$result = $this->_db->loadResult()) {
                $this->setError($this->_db->stderr());
                return false;
        }
 
        return (boolean) $result;
}

[Edit See Also] SeeAlso:JTableSession/exists

Examples

<CodeExamplesForm />