Documentation

GetPasswordHash

string
CUser::GetPasswordHash(
 string PASSWORD_HASH
)

The method returns a hash string on the user password that can be used with functions LoginByHash and SavePasswordHash. Non-static method.

Parameters

ParameterDescription
PASSWORD_HASH Hash (MD5) on the real password of a user. You can obtain the MD5 hash on the current user password by calling the $USER->GetParam("PASSWORD_HASH") method. For an arbitrary user, the MD5 hash can be obtained by calling the CUser::GetByID method ("PASSWORD" field).

See Also

Examples of use

<?
function SetCurrentUserAuthCookie()
{
  global $USER;
  $hash = CUser::GetPasswordHash($USER->GetParam("PASSWORD_HASH"));
  $name = COption::GetOptionString("main", "cookie_name", "BITRIX_SM")."_UIDH";
  @setcookie($name, $hash, time()+60*60*24*30*60, "/"); 
}
?>


© «Bitrix24», 2001-2024
Up