本文整理汇总了PHP中CUser::GetByLogin方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::GetByLogin方法的具体用法?PHP CUser::GetByLogin怎么用?PHP CUser::GetByLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetByLogin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserCreate
public static function UserCreate($name, $phone, $domen, $login, $group) //$name - string, $phone - string, $domen - string, $login - string, $group - array
{
if (CUser::IsAuthorized()) {
$userId = CUser::GetID();
return (int)$userId;
} else {
$usersCheck = CUser::GetByLogin($login);
if ($arUser = $usersCheck->Fetch()) {
return (int)$arUser["ID"];
} else {
$stringPhone = preg_replace('~\D~','',$phone);
$password = OrderClick::GeneratePassword(10);
$user = new CUser;
$arFields = Array(
"NAME" => $name,
"EMAIL" => $stringPhone . "@" . $domen,
"LOGIN" => $phone,
"ACTIVE" => "N", // Делаю пользователя не активным
"GROUP_ID" => $group,
"PASSWORD" => $password,
"CONFIRM_PASSWORD" => $password,
"PERSONAL_PHONE" => $stringPhone,
);
return $user->Add($arFields);
}
}
}
示例2: FindNotUsedLogin
/**
* Finds first free login adding "-1", "-2" etc. to $login
* @param string $login
* @return string
*/
public static function FindNotUsedLogin($login)
{
$i = 0;
do {
++$i;
$newlogin = $login . "-{$i}";
} while (CUser::GetByLogin($newlogin)->SelectedRowsCount() > 0);
return $newlogin;
}
示例3: GetUserName
function GetUserName($USER_ID, $sNameTemplate = "")
{
$sNameTemplate = str_replace(array("#NOBR#", "#/NOBR#"), "", !empty($sNameTemplate) ? $sNameTemplate : CSite::GetDefaultNameFormat());
if (intval($USER_ID) <= 0) {
$db_res = CUser::GetByLogin($USER_ID);
$ar_res = $db_res->Fetch();
$USER_ID = $ar_res["ID"];
}
return CForumUser::GetFormattedNameByUserID($USER_ID, $sNameTemplate);
}
示例4: CheckAuthorization
function CheckAuthorization($user, $password)
{
$UserAuthTry = new CUser();
$authTry = $UserAuthTry->Login($user, $password);
if ($authTry === true) {
$unode = $UserAuthTry->GetByLogin($user);
$uinfo = $unode->Fetch();
return $uinfo;
}
return new CSOAPFault('Server Error', 'Unable to authorize user.');
}
示例5: DeleteByLogin
public function DeleteByLogin($login)
{
if (!$login) {
throw new \Exception("Unexpected login", 1);
} else {
$user = \CUser::GetByLogin($login)->Fetch();
$subscriber = \CSubscription::GetByEmail($user["EMAIL"])->Fetch();
\CSubscription::Delete($subscriber["ID"]);
return True;
}
}
示例6: GetUserName
function GetUserName($USER_ID, $nameTemplate = "")
{
$ar_res = false;
if (IntVal($USER_ID) > 0) {
$db_res = CUser::GetByID(IntVal($USER_ID));
$ar_res = $db_res->Fetch();
}
if (!$ar_res) {
$db_res = CUser::GetByLogin($USER_ID);
$ar_res = $db_res->Fetch();
}
$USER_ID = IntVal($ar_res["ID"]);
$f_LOGIN = htmlspecialcharsex($ar_res["LOGIN"]);
$forum_user = CForumUser::GetByUSER_ID($USER_ID);
if ($forum_user["SHOW_NAME"] == "Y" && (strlen(trim($ar_res["NAME"])) > 0 || strlen(trim($ar_res["LAST_NAME"])) > 0)) {
$nameTemplate = trim(empty($nameTemplate)) ? CSite::GetNameFormat() : $nameTemplate;
return trim(CUser::FormatName($nameTemplate, array("NAME" => htmlspecialcharsEx($ar_res["NAME"]), "LAST_NAME" => htmlspecialcharsEx($ar_res["LAST_NAME"]), "SECOND_NAME" => htmlspecialcharsEx($ar_res["SECOND_NAME"]))));
} else {
return $f_LOGIN;
}
}
示例7: define
<?php
define("NOT_CHECK_PERMISSIONS", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (defined('BX_UTF') && BX_UTF == TRUE) {
$msg = array('charset' => 'UTF-8', 'userChngScs' => 'Пользователь успешно изменён.', 'userAddScs' => 'Пользователь успешно добавлен.', 'delScript' => 'Удалить скрипт', 'delScriptMsg' => 'В целях безопасности рекомендуется удалить данный скрипт из системы.', 'title' => 'Восстановление пароля администратора', 'go2admin' => 'Перейти в адмиинку', 'subTitle' => 'Введите имя пользователя и пароль', 'note' => 'Если такой пользователь существует, то его пароль будет перезаписан, а членство в группе администраторов — восстановлено. Если пользователя нет, то он будет создан.', 'login' => 'Логин', 'pswd' => 'Пароль', 'pswdRep' => 'Повтор пароля', 'email' => 'E-mail', 'send' => 'Отправить');
} else {
$msg = array('charset' => 'windows-1251', 'userChngScs' => '������������ ������� �������.', 'userAddScs' => '������������ ������� ��������.', 'delScript' => '������� ������', 'delScriptMsg' => '� ����� ������������ ������������� ������� ������ ������ �� �������.', 'title' => '�������������� ������ ��������������', 'go2admin' => '������� � ��������', 'subTitle' => '������� ��� ������������ � ������', 'note' => '���� ����� ������������ ����������, �� ��� ������ ����� �����������, � �������� � ������ ��������������� — �������������. ���� ������������ ���, �� �� ����� ������.', 'login' => '�����', 'pswd' => '������', 'pswdRep' => '������ ������', 'email' => 'E-mail', 'send' => '���������');
}
$arError = array();
$arMess = array();
if (isset($_POST['action']) && $_POST['action'] == 'submit') {
$rsUser = CUser::GetByLogin($_POST['login']);
$arUser = $rsUser->Fetch();
$user = new CUser();
$arFields = array('LOGIN' => $_POST['login'], 'ACTIVE' => 'Y', 'GROUP_ID' => array(1, 2), 'PASSWORD' => $_POST['pwd1'], 'CONFIRM_PASSWORD' => $_POST['pwd2']);
if (!empty($_POST['email'])) {
$arFields['EMAIL'] = $_POST['email'];
}
$userId = 0;
if ($arUser) {
$result = $user->Update($arUser['ID'], $arFields);
if (intval($result) > 0) {
$arMess[] = $msg['userChngScs'];
$userId = $arUser['ID'];
} else {
$arError[] = $user->LAST_ERROR;
}
} else {
$result = $user->Add($arFields);
if (intval($result) > 0) {
示例8: htmlspecialcharsEx
$strCaptchaWord = htmlspecialcharsEx(trim($_REQUEST['captcha_word']));
$strCaptchaSid = htmlspecialcharsEx(trim($_REQUEST['captcha_sid']));
if (check_bitrix_sessid() || !strlen($strCaptchaSid) || !strlen($strSessid)) {
$arrErrorField = array();
if (!strlen($strEmail)) $arrErrorField['REG_EMAIL'] = 'Поле E-mail обязательное, заполните его.';
if (!strlen($strCaptchaWord)) $arrErrorField['REG_CAPTCHA_WORD'] = 'Поле цифры обязательное, заполните его.';
if (!count($arrErrorField)) {
if (strlen($strEmail) < 6) $arrErrorField['REG_EMAIL'] = 'Минимальное количество символов 6 символов.';
if (strlen($strCaptchaWord) < 5) $arrErrorField['REG_CAPTCHA_WORD'] = 'Минимальное количество символов 5 символов.';
if (!count($arrErrorField)) {
if (!check_email($strEmail)) $arrErrorField['REG_EMAIL'] = 'Вы ввели не правильный E-Mail.';
if (!$APPLICATION->CaptchaCheckCode($strCaptchaWord, $strCaptchaSid)) $arrErrorField['REG_CAPTCHA_WORD'] = 'Вы ввели не правильные цифры с картинки.';
if (!count($arrErrorField)) {
// Проверим уникальность E-Mail
$rsUser = CUser::GetByLogin($strEmail);
if ($arUser = $rsUser->Fetch()) {
// Такой пользователь есть
$arrResult['error_message'] = 'Указанный E-Mail уже зарегистрирован в базе сайта. Данные авторизации были отправлены Вам на электронный адрес. Если Вы утеряли их, то всегда можете восстановить перейдя по ссылке забыли пароль в форме авторизации.';
$arrErrorField['REG_EMAIL'] = ' ';
} else {
// Это новый пользователь
// Регим его
$strPassword = randString();
$arResult = $USER->Register($strEmail, '', '', $strPassword, $strPassword, $strEmail);
if ($arResult['ID']) {
$arrResult['result'] = 'ok';
$arrResult['login'] = $strEmail;
$arrResult['password'] = $strPassword;
} else $arrResult['error_message'] = 'Регистрация не удалась.';
}//\\ if
示例9: ImportUser
function ImportUser()
{
if ($this->isErrorOccured) {
return false;
}
$this->errorMessage = "";
$defaultEmail = $this->GetDefaultEmail();
if (!($arUser = $this->csv->FetchDelimiter())) {
return false;
}
$arFields = array();
foreach ($this->arHeader as $index => $key) {
if (($f = trim($arUser[$index])) != '') {
$arFields[$key] = $f;
}
}
if (!array_key_exists("NAME", $arFields) || strlen($arFields["NAME"]) < 1) {
$this->errorMessage = GetMessage("CSV_IMPORT_NO_NAME") . " (" . implode(", ", $arFields) . ").<br>";
return true;
}
if (!array_key_exists("LAST_NAME", $arFields) || strlen($arFields["LAST_NAME"]) < 1) {
$this->errorMessage = GetMessage("CSV_IMPORT_NO_LASTNAME") . " (" . implode(", ", $arFields) . ").<br>";
return true;
}
if (!array_key_exists("PASSWORD", $arFields) || strlen($arFields["PASSWORD"]) < 1) {
$arFields["PASSWORD"] = $this->GenerateUserPassword(6);
}
$arFields["CONFIRM_PASSWORD"] = $arFields["PASSWORD"];
if (!array_key_exists("EMAIL", $arFields) || strlen($arFields["EMAIL"]) < 3 || !check_email($arFields["EMAIL"])) {
$arFields["EMAIL"] = $defaultEmail;
}
if (!array_key_exists("LOGIN", $arFields)) {
$arFields["LOGIN"] = ToLower($arFields["NAME"] . " " . $arFields["LAST_NAME"]);
}
if (array_key_exists("PERSONAL_BIRTHDAY", $arFields) && (strlen($arFields["PERSONAL_BIRTHDAY"]) < 2 || !CheckDateTime($arFields["PERSONAL_BIRTHDAY"]))) {
unset($arFields["PERSONAL_BIRTHDAY"]);
}
if (array_key_exists("DATE_REGISTER", $arFields) && (strlen($arFields["DATE_REGISTER"]) < 2 || !CheckDateTime($arFields["DATE_REGISTER"]))) {
unset($arFields["DATE_REGISTER"]);
}
if ($this->externalAuthID !== null && !array_key_exists("EXTERNAL_AUTH_ID", $arFields)) {
$arFields["EXTERNAL_AUTH_ID"] = $this->externalAuthID;
}
if (!array_key_exists("XML_ID", $arFields)) {
$arFields["XML_ID"] = md5(uniqid(rand(), true));
}
if (!array_key_exists("CHECKWORD", $arFields) || strlen($arFields["CHECKWORD"]) <= 0) {
$arFields["CHECKWORD"] = md5(CMain::GetServerUniqID() . uniqid());
}
if ($this->imageFilePath !== null) {
if (array_key_exists("PERSONAL_PHOTO", $arFields) && strlen($arFields["PERSONAL_PHOTO"]) > 0) {
$arFile = CFile::MakeFileArray($this->imageFilePath . "/" . $arFields["PERSONAL_PHOTO"]);
$arFile["MODULE_ID"] = "main";
$arFields["PERSONAL_PHOTO"] = $arFile;
}
if (array_key_exists("WORK_LOGO", $arFields) && strlen($arFields["WORK_LOGO"]) > 0) {
$arFile = CFile::MakeFileArray($this->imageFilePath . "/" . $arFields["WORK_LOGO"]);
$arFile["MODULE_ID"] = "main";
$arFields["WORK_LOGO"] = $arFile;
}
} else {
unset($arFields["PERSONAL_PHOTO"]);
unset($arFields["WORK_LOGO"]);
}
$arFields["GROUP_ID"] = $this->userGroups;
$user = new CUser();
$userID = (int) $user->Add($arFields);
if ($userID <= 0) {
if ($user->LAST_ERROR != '') {
$this->errorMessage = $arFields["NAME"] . " " . $arFields["LAST_NAME"] . ": " . $user->LAST_ERROR;
}
}
if ($userID <= 0 && $this->ignoreDuplicate === false) {
$postFix = 2;
$login = $arFields["LOGIN"];
do {
$rsUser = CUser::GetByLogin($arFields["LOGIN"]);
if (!$rsUser->Fetch()) {
break;
}
$arFields["LOGIN"] = $login . $postFix;
$userID = (int) $user->Add($arFields);
if ($userID > 1) {
break;
}
$postFix++;
} while (true);
}
if ($userID > 0) {
if ($this->attachIBlockID > 0) {
$iblockSectionID = $this->__GetIBlockSectionID($arFields);
if ($iblockSectionID > 0) {
if (!$this->isUserPropertyCreate) {
$this->isUserPropertyCreate = $this->__CreateUserProperty();
}
$arUpdate = array();
$arUpdate[$this->userPropertyName] = array($iblockSectionID);
$user->Update($userID, $arUpdate);
}
}
//.........这里部分代码省略.........
示例10: elseif
if ($arUserLogin = $dbUserLogin->Fetch()) {
$newLoginTmp = $NEW_LOGIN;
$uind = 0;
do {
$uind++;
if ($uind == 10) {
$NEW_LOGIN = $arUserResult["USER_EMAIL"];
$newLoginTmp = $NEW_LOGIN;
} elseif ($uind > 10) {
$NEW_LOGIN = "buyer" . time() . GetRandomCode(2);
$newLoginTmp = $NEW_LOGIN;
break;
} else {
$newLoginTmp = $NEW_LOGIN . $uind;
}
$dbUserLogin = CUser::GetByLogin($newLoginTmp);
} while ($arUserLogin = $dbUserLogin->Fetch());
$NEW_LOGIN = $newLoginTmp;
}
$def_group = COption::GetOptionString("main", "new_user_registration_def_group", "");
if ($def_group != "") {
$GROUP_ID = explode(",", $def_group);
$arPolicy = $USER->GetGroupPolicy($GROUP_ID);
} else {
$arPolicy = $USER->GetGroupPolicy(array());
}
$password_min_length = intval($arPolicy["PASSWORD_LENGTH"]);
if ($password_min_length <= 0) {
$password_min_length = 6;
}
$password_chars = array("abcdefghijklnmopqrstuvwxyz", "ABCDEFGHIJKLNMOPQRSTUVWXYZ", "0123456789");
示例11: define
<?
define("NO_KEEP_STATISTIC", true);
define("NO_AGENT_STATISTIC", true);
require_once($_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/main/include/prolog_before.php');
$arRes = Array();
if (isset($_POST['EMAIL'])){
$email = trim($_POST['EMAIL']);
if (strlen($email) > 0){
$rsUser = CUser::GetByLogin($email);
if (intval($rsUser->SelectedRowsCount())>0)
$arRes["RESULT"] = "Y";
else
$arRes["RESULT"] = "N";
}
}
elseif(isset($_POST['ADDRESS_ID']) && CModule::IncludeModule("useraddress") && CModule::IncludeModule("sale"))
{
$addressID = intval($_POST['ADDRESS_ID']);
$addressInfo = CUserAddress::getAddressId($addressID);
//поиск LOCATION по названию города
$db_vars = CSaleLocation::GetList(
array(),
array("LID" => LANGUAGE_ID, "CITY_NAME" => trim($addressInfo[0]["CITY"])),
false,
false,
array("ID")
示例12: array
}
$res = CControllerMember::CheckUserAuth($ar_mem["ID"], $oRequest->arParameters['login'], $oRequest->arParameters['password']);
if (is_array($res)) {
$oResponse->arParameters = $res;
$oResponse->status = "200 OK";
} else {
$oResponse->status = "473 Bad password.";
$e = $APPLICATION->GetException();
$oResponse->text = $e->GetString();
}
break;
case 'check_auth':
$dbr = CControllerMember::GetByGuid($oRequest->member_id);
$ar = $dbr->Fetch();
$arControllerLog = array('NAME' => 'AUTH', 'CONTROLLER_MEMBER_ID' => $ar["ID"], 'STATUS' => 'Y');
$dbUser = CUser::GetByLogin($oRequest->arParameters['login']);
if (!($arUser = $dbUser->Fetch())) {
$oResponse->status = "444 User is not found.";
$oResponse->text = "User is not found.";
$arControllerLog['STATUS'] = 'N';
} else {
if (strlen($arUser["PASSWORD"]) > 32) {
$salt = substr($arUser["PASSWORD"], 0, strlen($arUser["PASSWORD"]) - 32);
$db_password = substr($arUser["PASSWORD"], -32);
} else {
$salt = "";
$db_password = $arUser["PASSWORD"];
}
if ($arUser['ACTIVE'] == 'Y' && md5($db_password . 'MySalt') == md5(md5($salt . $oRequest->arParameters['password']) . 'MySalt')) {
$arSaveUser = CControllerClient::PrepareUserInfo($arUser);
$arSaveUser["GROUP_ID"] = array();
示例13: ExistenceUserLogin
public static function ExistenceUserLogin($Login = "")
{
$Query = CUser::GetByLogin($Login)->Fetch();
return empty($Query) ? 0 : $Query["ID"];
}
示例14: forumTextParser
// $arParams["DISPLAY_PANEL"] = ($arParams["DISPLAY_PANEL"] == "Y" ? "Y" : "N");
/********************************************************************
/Input params
********************************************************************/
$parser = new forumTextParser();
$parser->MaxStringLen = $arParams["WORD_LENGTH"];
$parser->userPath = $arParams["URL_TEMPLATES_PROFILE_VIEW"];
$parser->userNameTemplate = $arParams["NAME_TEMPLATE"];
$arResult["USER"] = array();
$arResult["FORUM_USER"] = array();
$bUserFound = $ar_res = false;
if (!empty($arParams["UID"])) {
false;
$db_res = CUser::GetByID(intVal($arParams["UID"]));
if (!($ar_res = $db_res->Fetch())) {
$db_res = CUser::GetByLogin($arParams["UID"]);
$ar_res = $db_res->Fetch();
$arParams["UID"] = $ar_res["ID"];
}
$bUserFound = !empty($ar_res) && is_array($ar_res);
}
if (!$bUserFound) {
CHTTP::SetStatus("404 Not Found");
ShowError(empty($arParams["UID"]) ? GetMessage("F_NO_UID") : GetMessage("F_NO_DUSER", array("#UID#" => htmlspecialcharsEx($arParams["UID"]))));
return false;
}
foreach ($ar_res as $key => $val) {
$arResult["USER"]["~" . $key] = $val;
$arResult["USER"][$key] = is_string($val) ? $parser->wrap_long_words(htmlspecialcharsex(trim($val))) : $val;
}
$arResult["USER"]["PERSONAL_BIRTHDAY_FORMATED"] = CForumFormat::FormatDate($arResult["USER"]["~PERSONAL_BIRTHDAY"], CLang::GetDateFormat("SHORT"), $arParams["DATE_FORMAT"]);
示例15: foreach
}
}
foreach ($arResult['FROM_ACCOUNT'] as $curr => &$arAcc) {
if (empty($arAcc)) {
$arAcc = array('CURRENT_BUDGET' => 0.0, 'CURRENCY' => $curr, 'CURRENT_BUDGET_FORMATED' => SaleFormatCurrency(0, $curr));
}
}
if (strlen($_REQUEST['send_money']) && check_bitrix_sessid()) {
$arResult['MONEY_OFF'] = round($arResult['REQUEST_AMOUNT'] + $arResult['REQUEST_AMOUNT'] / 100 * $arParams['COMISSION'], 2);
if ($arResult['REQUEST_AMOUNT'] <= 0 || !strlen($arResult['REQUEST_USER']) || !strlen($arResult['REQUEST_ACCOUNT'])) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_REQUIRED_FIELDS');
}
if (!strlen($arResult['ERROR']) && $arResult['FROM_ACCOUNT'][$arResult['REQUEST_ACCOUNT']]['CURRENT_BUDGET'] < $arResult['MONEY_OFF']) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_NOT_ENOUGH');
}
if (!strlen($arResult['ERROR']) && !($arUser = CUser::GetByLogin($arResult['REQUEST_USER'])->Fetch()) && !($arUser = CUser::GetByID($arResult['REQUEST_USER'])->Fetch())) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_USER_NOT_FOUND');
}
if (!strlen($arResult['ERROR']) && $arUser['ID'] == $USER->GetID()) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_CANNT_YOURSELF');
}
if (!strlen($arResult['ERROR'])) {
$arResult['TO_USER'] = $arUser;
if (strlen($_REQUEST['send_money_now'])) {
$arUserCurr = CUser::GetByID($USER->GetID())->Fetch();
CSaleUserAccount::UpdateAccount($USER->GetID(), -$arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], GetMessage('SPT_TRANSACT_DESC_FROM', $arUser), 0, $arResult['~REQUEST_COMMENT']);
CSaleUserAccount::UpdateAccount($arUser['ID'], $arResult['REQUEST_AMOUNT'], $arResult['REQUEST_ACCOUNT'], GetMessage('SPT_TRANSACT_DESC_TO', $arUserCurr), 0, $arResult['~REQUEST_COMMENT']);
if ($arParams['NOTIFY_USER'] == 'Y' && CModule::IncludeModule('socialnetwork')) {
$letter = GetMessage('SPT_MESS_DESC_TO', array_merge($arUserCurr, array('SUM' => SaleFormatCurrency($arResult['REQUEST_AMOUNT'], $arResult['REQUEST_ACCOUNT']))));
if (strlen($arResult['~REQUEST_COMMENT'])) {
$letter .= ' (' . $arResult['~REQUEST_COMMENT'] . ')';