Bitrix Site Manager

CUser::GetPasswordHash

string
CUser::GetPasswordHash(
 string password_md5
)

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

Parameters

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

See Also

Example



<?
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, "/"); 
}
?>