API15

JSession/getToken

From Joomla! Documentation

< API15:JSession
Revision as of 17:17, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Get a session token, if a token isn't set yet one will be generated. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JSession/getTo...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API15" 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[edit]

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

[Edit Descripton]

Template:Description:JSession/getToken

Syntax[edit]

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

Returns[edit]

string The session token

Defined in[edit]

libraries/joomla/session/session.php

Importing[edit]

jimport( 'joomla.session.session' );

Source Body[edit]

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

[Edit See Also] Template:SeeAlso:JSession/getToken

Examples[edit]

<CodeExamplesForm />