mixed CUser::Login( string login, string password, string set_auth_cookie = "N", string convert_password_to_md5 = "Y" )
The method Login verifies the login and password and performs or declines the user authorization depending on the verification result. Returns true on successful authorization. In case the authorization failed (login and/or password are incorrect), the method returns the error description array that can be passed to ShowMessage.
|password||User password. If the parameter convert_password_to_md5 is "Y", this parameter must contain the original password string. Otherwise, it must contain the MD5 hash on the original password.|
|set_auth_cookie||If "Y", the authorization is to be stored in cookie (the visitor will be authorized automatically next time); otherwise, the authorization is not preserved. The information stored in cookie is a special hash obtained by a call to method CUser::GetPasswordHash.
The system automatically authorizes the visitor next time by using the method CUser::LoginByHash.
Optional; "N" by default.
|convert_password_to_md5||A value of "Y" means that the password contains a real password as typed by a visitor (not converted to MD5). If "N", the password has been previously converted to MD5.
You can obtain the MD5 for the current authorized user by calling $USER->GetParam("PASSWORD_HASH"). To get the MD5 for an arbitrary user, call CUser::GetByID (field "PASSWORD").
Optional; "Y" by default.
<? global $USER; if (!is_object($USER)) $USER = new CUser; $arAuthResult = $USER->Login("admin", "123456", "Y"); $APPLICATION->arAuthResult = $arAuthResult; ?>
<? global $USER; if (!is_object($USER)) $USER = new CUser; $arAuthResult = $USER->Login("admin", md5("123456"), "Y", "N"); $APPLICATION->arAuthResult = $arAuthResult; ?>
|© 2001-2005 Bitrix||Bitrix Site Manager - Content Management & Portal Solutions|