API16

JSession/getFormToken: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Method to determine a hash for anti-spoofing variable names <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JSession/getFormToken|E...
 
m clean up
Line 2: Line 2:
Method to determine a hash for anti-spoofing variable names
Method to determine a hash for anti-spoofing variable names


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JSession/getFormToken|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JSession/getFormToken}}
 
{{subst:Description:JSession/getFormToken}}


===Syntax===
===Syntax===
Line 41: Line 39:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JSession/getFormToken|Edit See Also]]<nowiki>]</nowiki>
{{subst:SeeAlso:JSession/getFormToken}}
</span>
{{SeeAlso:JSession/getFormToken}}


===Examples===
===Examples===

Revision as of 14:23, 24 March 2017

Description

Method to determine a hash for anti-spoofing variable names


{{subst:Description:JSession/getFormToken}}

Syntax

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

Returns

string Hashed var name

Defined in

libraries/joomla/session/session.php

Importing

jimport( 'joomla.session.session' );

Source Body

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


{{subst:SeeAlso:JSession/getFormToken}}

Examples

<CodeExamplesForm />