本文整理汇总了PHP中GetRandomCode函数的典型用法代码示例。如果您正苦于以下问题:PHP GetRandomCode函数的具体用法?PHP GetRandomCode怎么用?PHP GetRandomCode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRandomCode函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$NEW_LOGIN .= "_";
}
if (strlen($NEW_LOGIN) < 3) {
$NEW_LOGIN .= "_";
}
$dbUserLogin = CUser::GetByLogin($NEW_LOGIN);
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());
示例2: nodeHandler
//.........这里部分代码省略.........
{
$arOrder["USER_PROPS"][$arUPropValue["ORDER_PROPS_ID"]] = $arUPropValue["VALUE"];
}
}
else
{
if(strlen($arOrder["AGENT"]["ID"]) > 0)
{
$arAI = explode("#", $arOrder["AGENT"]["ID"]);
if(IntVal($arAI[0]) > 0)
{
$dbUser = CUser::GetByID($arAI[0]);
if($arU = $dbUser->Fetch())
{
if(htmlspecialcharsback(substr(htmlspecialcharsbx($arU["ID"]."#".$arU["LOGIN"]."#".$arU["LAST_NAME"]." ".$arU["NAME"]." ".$arU["SECOND_NAME"]), 0, 80)) == $arOrder["AGENT"]["ID"])
{
$arOrder["USER_ID"] = $arU["ID"];
}
}
}
}
if(IntVal($arOrder["USER_ID"]) <= 0)
{
//create new user
$arUser = array(
"NAME" => $arOrder["AGENT"]["ITEM_NAME"],
"EMAIL" => $arOrder["AGENT"]["CONTACT"]["MAIL_NEW"],
);
if (strlen($arUser["NAME"]) <= 0)
$arUser["NAME"] = $arOrder["AGENT"]["CONTACT"]["CONTACT_PERSON"];
if (strlen($arUser["EMAIL"]) <= 0)
$arUser["EMAIL"] = "buyer".time().GetRandomCode(2)."@".$_SERVER["SERVER_NAME"];
$arOrder["USER_ID"] = CSaleUser::DoAutoRegisterUser($arUser["EMAIL"], $arUser["NAME"], $this->arParams["SITE_NEW_ORDERS"], $arErrors);
}
}
if(empty($this->arPersonTypesIDs))
{
$dbPT = CSalePersonType::GetList(array(), array("ACTIVE" => "Y", "LIDS" => $this->arParams["SITE_NEW_ORDERS"]));
while($arPT = $dbPT->Fetch())
{
$this->arPersonTypesIDs[] = $arPT["ID"];
}
}
if(empty($this->arExportInfo))
{
$dbExport = CSaleExport::GetList(array(), array("PERSON_TYPE_ID" => $this->arPersonTypesIDs));
while($arExport = $dbExport->Fetch())
{
$this->arExportInfo[$arExport["PERSON_TYPE_ID"]] = unserialize($arExport["VARS"]);
}
}
if(IntVal($arOrder["PERSON_TYPE_ID"]) <= 0)
{
foreach($this->arExportInfo as $pt => $value)
{
if(
(($value["IS_FIZ"] == "Y" && $arOrder["AGENT"]["TYPE"] == "FIZ")
|| ($value["IS_FIZ"] == "N" && $arOrder["AGENT"]["TYPE"] != "FIZ"))
)
$arOrder["PERSON_TYPE_ID"] = $pt;
}
示例3: DoAutoRegisterUser
public static function DoAutoRegisterUser($autoEmail, $payerName, $siteId, &$arErrors, $arOtherFields = null)
{
$autoEmail = trim($autoEmail);
if (empty($autoEmail)) {
return null;
}
if ($siteId == null) {
$siteId = SITE_ID;
}
$autoName = "";
$autoLastName = "";
if (!is_array($payerName) && strlen($payerName) > 0) {
$arNames = explode(" ", $payerName);
$autoName = $arNames[1];
$autoLastName = $arNames[0];
$autoSecondName = false;
} elseif (is_array($payerName)) {
$autoName = $payerName["NAME"];
$autoLastName = $payerName["LAST_NAME"];
$autoSecondName = $payerName["SECOND_NAME"];
}
$autoLogin = $autoEmail;
$pos = strpos($autoLogin, "@");
if ($pos !== false) {
$autoLogin = substr($autoLogin, 0, $pos);
}
if (strlen($autoLogin) > 47) {
$autoLogin = substr($autoLogin, 0, 47);
}
while (strlen($autoLogin) < 3) {
$autoLogin .= "_";
}
$idx = 0;
$loginTmp = $autoLogin;
$dbUserLogin = CUser::GetByLogin($autoLogin);
while ($arUserLogin = $dbUserLogin->Fetch()) {
$idx++;
if ($idx == 10) {
$autoLogin = $autoEmail;
} elseif ($idx > 10) {
$autoLogin = "buyer" . time() . GetRandomCode(2);
break;
} else {
$autoLogin = $loginTmp . $idx;
}
$dbUserLogin = CUser::GetByLogin($autoLogin);
}
$defaultGroup = COption::GetOptionString("main", "new_user_registration_def_group", "");
if ($defaultGroup != "") {
$arDefaultGroup = explode(",", $defaultGroup);
$arPolicy = CUser::GetGroupPolicy($arDefaultGroup);
} else {
$arPolicy = CUser::GetGroupPolicy(array());
}
$passwordMinLength = intval($arPolicy["PASSWORD_LENGTH"]);
if ($passwordMinLength <= 0) {
$passwordMinLength = 6;
}
$passwordChars = array("abcdefghijklnmopqrstuvwxyz", "ABCDEFGHIJKLNMOPQRSTUVWXYZ", "0123456789");
if ($arPolicy["PASSWORD_PUNCTUATION"] === "Y") {
$passwordChars[] = ",.<>/?;:'\"[]{}\\|`~!@#\$%^&*()-_+=";
}
$autoPassword = randString($passwordMinLength + 2, $passwordChars);
$arFields = array("LOGIN" => $autoLogin, "NAME" => $autoName, "LAST_NAME" => $autoLastName, "SECOND_NAME" => $autoSecondName, "PASSWORD" => $autoPassword, "PASSWORD_CONFIRM" => $autoPassword, "EMAIL" => $autoEmail, "GROUP_ID" => $arDefaultGroup, "LID" => $siteId);
$arFields["ACTIVE"] = isset($arOtherFields["ACTIVE"]) && $arOtherFields["ACTIVE"] == "N" ? "N" : "Y";
if (isset($arOtherFields["ACTIVE"])) {
unset($arOtherFields["ACTIVE"]);
}
if (is_array($arOtherFields)) {
foreach ($arOtherFields as $key => $value) {
if (!array_key_exists($key, $arFields)) {
$arFields[$key] = $value;
}
}
}
$user = new CUser();
$userId = $user->Add($arFields);
if (intval($userId) <= 0) {
$arErrors[] = array("TEXT" => Loc::getMessage("STOF_ERROR_REG") . (strlen($user->LAST_ERROR) > 0 ? ": " . $user->LAST_ERROR : ""));
return 0;
}
return $userId;
}
示例4: array
$F_USER_FIELDS = array();
if (!empty($arRes)) {
foreach ($arRes as $key => $val) {
$F_USER_FIELDS[$val["FIELD_NAME"]] = empty($val["EDIT_FORM_LABEL"]) ? $val["FIELD_NAME"] : $val["EDIT_FORM_LABEL"];
}
}
if ($db_res && ($res = $db_res->GetNext())) {
do {
$iForumDefault = intVal($res["ID"]);
$arForum[intVal($res["ID"])] = $res["NAME"];
if ($selectedForum !== null && $selectedForum === intval($res['ID'])) {
$selectedForumProps = $res;
}
} while ($res = $db_res->GetNext());
}
$uniqueID = !is_set($arCurrentValues, "UNIQUE_ID") || $arCurrentValues["UNIQUE_ID"] === "" ? "F_COMMENTS_" . strtoupper(GetRandomCode(4)) : $arCurrentValues["UNIQUE_ID"];
$arComponentParameters = array("GROUPS" => array("EDITOR_SETTINGS" => array("NAME" => GetMessage("F_EDITOR_SETTINGS"))), "PARAMETERS" => array("ENTITY_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("F_ENTITY_TYPE"), "TYPE" => "STRING", "COLS" => 2, "DEFAULT" => ""), "ENTITY_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("F_ENTITY_ID"), "TYPE" => "STRING", "DEFAULT" => ""), "ENTITY_XML_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("F_ENTITY_XML_ID"), "TYPE" => "STRING", "DEFAULT" => ""), "FORUM_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("F_FORUM_ID"), "TYPE" => "LIST", "DEFAULT" => $iForumDefault, "REFRESH" => "Y", "VALUES" => $arForum), "PERMISSION" => array("PARENT" => "BASE", "NAME" => GetMessage("F_PERMISSION"), "TYPE" => "STRING", "COLS" => 1, "DEFAULT" => ""), "USER_FIELDS" => array("PARENT" => "BASE", "NAME" => GetMessage("F_USER_FIELDS"), "TYPE" => "LIST", "VALUES" => $F_USER_FIELDS, "MULTIPLE" => "Y", "DEFAULT" => array_keys($F_USER_FIELDS), "HIDDEN" => $hidden), "URL_TEMPLATES_READ" => array("PARENT" => "URL_TEMPLATES", "NAME" => GetMessage("F_READ_TEMPLATE"), "TYPE" => "STRING", "DEFAULT" => ""), "URL_TEMPLATES_PROFILE_VIEW" => array("PARENT" => "URL_TEMPLATES", "NAME" => GetMessage("F_PROFILE_VIEW_TEMPLATE"), "TYPE" => "STRING", "DEFAULT" => ""), "MESSAGES_PER_PAGE" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("F_MESSAGES_PER_PAGE"), "TYPE" => "STRING", "DEFAULT" => intVal(COption::GetOptionString("forum", "MESSAGES_PER_PAGE", "10"))), "PAGE_NAVIGATION_TEMPLATE" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("F_PAGE_NAVIGATION_TEMPLATE"), "TYPE" => "STRING", "DEFAULT" => ""), "DATE_TIME_FORMAT" => CComponentUtil::GetDateTimeFormatField(GetMessage("F_DATE_TIME_FORMAT"), "ADDITIONAL_SETTINGS"), "NAME_TEMPLATE" => array("TYPE" => "LIST", "NAME" => GetMessage("F_NAME_TEMPLATE"), "VALUES" => CComponentUtil::GetDefaultNameTemplates(), "MULTIPLE" => "N", "ADDITIONAL_VALUES" => "Y", "DEFAULT" => "", "PARENT" => "ADDITIONAL_SETTINGS"), "IMAGE_SIZE" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("F_IMAGE_SIZE"), "TYPE" => "STRING", "DEFAULT" => "600"), "IMAGE_HTML_SIZE" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("F_IMAGE_HTML_SIZE"), "TYPE" => "STRING", "DEFAULT" => "0"), "EDITOR_CODE_DEFAULT" => array("NAME" => GetMessage("F_EDITOR_CODE_DEFAULT"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "PARENT" => "ADDITIONAL_SETTINGS"), "SUBSCRIBE_AUTHOR_ELEMENT" => array("NAME" => GetMessage("F_SUBSCRIBE_AUTHOR_ELEMENT"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "PARENT" => "ADDITIONAL_SETTINGS"), "SHOW_RATING" => array("NAME" => GetMessage("F_SHOW_RATING"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "PARENT" => "ADDITIONAL_SETTINGS"), "SHOW_MINIMIZED" => array("NAME" => GetMessage("F_SHOW_MINIMIZED"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "PARENT" => "ADDITIONAL_SETTINGS"), "USE_CAPTCHA" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("F_USE_CAPTCHA"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "PREORDER" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("F_PREORDER"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "CACHE_TIME" => array()));
$arEditorSettings = array("ALLOW_HTML", "ALLOW_ANCHOR", "ALLOW_BIU", "ALLOW_IMG", "ALLOW_VIDEO", "ALLOW_LIST", "ALLOW_QUOTE", "ALLOW_CODE", "ALLOW_TABLE", "ALLOW_FONT", "ALLOW_SMILES", "ALLOW_NL2BR");
foreach ($arEditorSettings as $settingName) {
$hidden = "N";
if ($selectedForumProps !== null) {
$hidden = $selectedForumProps[$settingName] === "N";
}
$arComponentParameters['PARAMETERS'][$settingName] = array("PARENT" => "EDITOR_SETTINGS", "NAME" => GetMessage($settingName . "_TITLE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "HIDDEN" => $hidden);
}
/*
GetMessage("ALLOW_HTML_TITLE");
GetMessage("ALLOW_ANCHOR_TITLE");
GetMessage("ALLOW_BIU_TITLE");
GetMessage("ALLOW_IMG_TITLE");
GetMessage("ALLOW_VIDEO_TITLE");
示例5:
$dbUserLogin = CUser::GetByLogin($arResult["AUTH"]["NEW_LOGIN"]);
if ($arUserLogin = $dbUserLogin->Fetch())
{
$newLoginTmp = $arResult["AUTH"]["NEW_LOGIN"];
$uind = 0;
do
{
$uind++;
if ($uind == 10)
{
$arResult["AUTH"]["NEW_LOGIN"] = $arResult["AUTH"]["NEW_EMAIL"];
$newLoginTmp = $arResult["AUTH"]["NEW_LOGIN"];
}
elseif ($uind > 10)
{
$arResult["AUTH"]["NEW_LOGIN"] = "buyer".time().GetRandomCode(2);
$newLoginTmp = $arResult["AUTH"]["NEW_LOGIN"];
break;
}
else
{
$newLoginTmp = $arResult["AUTH"]["NEW_LOGIN"].$uind;
}
$dbUserLogin = CUser::GetByLogin($newLoginTmp);
}
while ($arUserLogin = $dbUserLogin->Fetch());
$arResult["AUTH"]["NEW_LOGIN"] = $newLoginTmp;
}
$def_group = COption::GetOptionString("main", "new_user_registration_def_group", "");
if($def_group!="")