Back to Session class

Method getFormToken

public static string
getFormToken
(mixed $forceNew = false)
Method to determine a hash for anti-spoofing variable names
Parameters
  • bool $forceNew If true, force a new token to be created
Returns
  • string Hashed var name
Since
  • 1.6
Class: Session
Project: Joomla

Method getFormToken - Source code

/**
 * Method to determine a hash for anti-spoofing variable names
 *
 * @param   boolean  $forceNew  If true, force a new token to be created
 *
 * @return  string  Hashed var name
 *
 * @since   1.6
 */
public static function getFormToken($forceNew = false)
{
    $user = Factory::getUser();
    return ApplicationHelper::getHash($user->get('id', 0) . Factory::getApplication()->getSession()->getToken($forceNew));
}