Romain
Romain

Reputation: 11

Joomla execute script when timeout?

My question may be a noob one but:

I want to execute a php script when a user timeout. The only way I found to do so is to make the server execute a script every second or minute for instance, get the last activity of every user and execute a script when the last activity is older than (now() - timeout).

is this the appropriate solution? Is this will slow the website significantly?

Many thanks in advance!

Upvotes: 0

Views: 156

Answers (1)

A Smith
A Smith

Reputation: 237

I believe this file should help you out. Located site_root/libraries/joomla/database/table/session.php Line 152:

public function exists($userid)
{
    $query = $this->_db->getQuery(true);
    $query->select('COUNT(userid)');
    $query->from($this->_db->quoteName($this->_tbl));
    $query->where($this->_db->quoteName('userid') . ' = ' . $this->_db->quote($userid));
    $this->_db->setQuery($query);

    if (!$result = $this->_db->loadResult())
    {
        $this->setError($this->_db->stderr());
        return false;
    }

    return (boolean) $result;
}

Upvotes: 1

Related Questions