API16

JSession/getFormToken

From Joomla! Documentation

< 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[edit]

Method to determine a hash for anti-spoofing variable names



Syntax[edit]

static getFormToken($forceNew=false)
Parameter Name Default Value Description
$forceNew false

Returns[edit]

string Hashed var name

Defined in[edit]

libraries/joomla/session/session.php

Importing[edit]

jimport( 'joomla.session.session' );

Source Body[edit]

public static function getFormToken($forceNew = false)
{
        $user                   = &JFactory::getUser();
        $session                = &JFactory::getSession();
        $hash                   = JApplication::getHash($user->get('id', 0).$session->getToken($forceNew));
        return $hash;
}



Examples[edit]

Code Examples[edit]