JTableSession/exists: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Find out if a user has a one or more active sessions
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JTableSession/exists|Edit Desc... |
m clean up |
||
| Line 2: | Line 2: | ||
Find out if a user has a one or more active sessions | Find out if a user has a one or more active sessions | ||
{{Description:JTableSession/exists}} | |||
{{subst:Description:JTableSession/exists}} | |||
===Syntax=== | ===Syntax=== | ||
| Line 47: | Line 45: | ||
</source> | </source> | ||
{{subst:SeeAlso:JTableSession/exists}} | |||
{{SeeAlso:JTableSession/exists}} | |||
===Examples=== | ===Examples=== | ||
Revision as of 14:31, 24 March 2017
Description
Find out if a user has a one or more active sessions
{{subst: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;
}
{{subst:SeeAlso:JTableSession/exists}}
Examples
<CodeExamplesForm />