Actions

API16

JSession/hasToken

< API16:JSession

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description

Method to determine if a token exists in the session. If not the session will be set to expired



Syntax

hasToken($tCheck, $forceExpire=true)
Parameter Name Default Value Description
$tCheck Hashed token to be verified
$forceExpire true If true, expires the session

Defined in

libraries/joomla/session/session.php

Importing

jimport( 'joomla.session.session' );

Source Body

public function hasToken($tCheck, $forceExpire = true)
{
        // check if a token exists in the session
        $tStored = $this->get('session.token');
 
        //check token
        if (($tStored !== $tCheck)) {
                if ($forceExpire) {
                        $this->_state = 'expired';
                }
                return false;
        }
 
        return true;
}



Examples

Code Examples


Advertisement