API16

JSession/getToken

< 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

Get a session token, if a token isn't set yet one will be generated.



Syntax

getToken($forceNew=false)
Parameter Name Default Value Description
$forceNew false If true, force a new token to be created

Returns

string The session token

Defined in

libraries/joomla/session/session.php

Importing

jimport( 'joomla.session.session' );

Source Body

public function getToken($forceNew = false)
{
        $token = $this->get('session.token');

        //create a token
        if ($token === null || $forceNew) {
                $token  =       $this->_createToken(12);
                $this->set('session.token', $token);
        }

        return $token;
}



Examples

Code Examples


Advertisement