Actions

API15

JSession/hasToken

From Joomla! Documentation

< API15:JSession
Revision as of 13:46, 12 May 2013 by JoomlaWikiBot (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

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

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

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

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;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />