本文整理汇总了PHP中qa_db_user_find_by_handle函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_db_user_find_by_handle函数的具体用法?PHP qa_db_user_find_by_handle怎么用?PHP qa_db_user_find_by_handle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_db_user_find_by_handle函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateUserHandle
private function generateUserHandle(NKUser $userData)
{
$name = preg_replace('/[^a-z0-9.]/i', '', $this->remove_plchars($userData->name()));
$check_name = true;
while ($check_name) {
$find = qa_db_user_find_by_handle($name);
if (count($find) > 0) {
$name .= mt_rand(0, 9);
} else {
$check_name = false;
}
}
return $name;
}
示例2: qa_handle_make_valid
function qa_handle_make_valid($handle, $allowuserid = null)
{
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
require_once QA_INCLUDE_DIR . 'qa-db-maxima.php';
if (!strlen($handle)) {
$handle = qa_lang('users/registered_user');
}
$handle = preg_replace('/[\\@\\+\\/]/', ' ', $handle);
for ($attempt = 0; $attempt <= 99; $attempt++) {
$suffix = $attempt ? ' ' . $attempt : '';
$tryhandle = qa_substr($handle, 0, QA_DB_MAX_HANDLE_LENGTH - strlen($suffix)) . $suffix;
$handleusers = qa_db_user_find_by_handle($tryhandle);
if (!(count($handleusers) && (!isset($allowuserid) || array_search($allowuserid, $handleusers) === false))) {
return $tryhandle;
}
}
qa_fatal_error('Could not create a unique handle');
}
示例3: qa_get
$passwordsent = qa_get('ps');
if (qa_clicked('dologin')) {
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
if (qa_limits_remaining(null, QA_LIMIT_LOGINS)) {
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
qa_limits_increment(null, QA_LIMIT_LOGINS);
$inemailhandle = qa_post_text('emailhandle');
$inpassword = qa_post_text('password');
$inremember = qa_post_text('remember');
$errors = array();
if (qa_opt('allow_login_email_only') || strpos($inemailhandle, '@') !== false) {
// handles can't contain @ symbols
$matchusers = qa_db_user_find_by_email($inemailhandle);
} else {
$matchusers = qa_db_user_find_by_handle($inemailhandle);
}
if (count($matchusers) == 1) {
// if matches more than one (should be impossible), don't log in
$inuserid = $matchusers[0];
$userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($inuserid, true));
if (strtolower(qa_db_calc_passcheck($inpassword, $userinfo['passsalt'])) == strtolower($userinfo['passcheck'])) {
// login and redirect
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
qa_set_logged_in_user($inuserid, $userinfo['handle'], $inremember ? true : false);
$topath = qa_get('to');
if (isset($topath)) {
qa_redirect_raw(qa_path_to_root() . $topath);
} elseif ($passwordsent) {
qa_redirect('account');
} else {
示例4: qa_handle_make_valid
function qa_handle_make_valid($handle)
{
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
require_once QA_INCLUDE_DIR . 'qa-db-maxima.php';
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
if (!strlen($handle)) {
$handle = qa_lang('users/registered_user');
}
$handle = preg_replace('/[\\@\\+\\/]/', ' ', $handle);
for ($attempt = 0; $attempt <= 99; $attempt++) {
$suffix = $attempt ? ' ' . $attempt : '';
$tryhandle = qa_substr($handle, 0, QA_DB_MAX_HANDLE_LENGTH - strlen($suffix)) . $suffix;
$filtermodules = qa_load_modules_with('filter', 'filter_handle');
foreach ($filtermodules as $filtermodule) {
$filtermodule->filter_handle($tryhandle, null);
}
// filter first without worrying about errors, since our goal is to get a valid one
$haderror = false;
foreach ($filtermodules as $filtermodule) {
$error = $filtermodule->filter_handle($tryhandle, null);
// now check for errors after we've filtered
if (isset($error)) {
$haderror = true;
}
}
if (!$haderror) {
$handleusers = qa_db_user_find_by_handle($tryhandle);
if (!count($handleusers)) {
return $tryhandle;
}
}
}
qa_fatal_error('Could not create a valid and unique handle from: ' . $handle);
}
示例5: core_login
function core_login($username, $password, $remember = false)
{
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
if (qa_user_limits_remaining(QA_LIMIT_LOGINS)) {
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
$errors = array();
if (qa_opt('allow_login_email_only') || strpos($username, '@') !== false) {
// handles can't contain @ symbols
$matchusers = qa_db_user_find_by_email($username);
} else {
$matchusers = qa_db_user_find_by_handle($username);
}
if (count($matchusers) == 1) {
// if matches more than one (should be impossible), don't log in
$inuserid = $matchusers[0];
$userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($inuserid, true));
if (strtolower(qa_db_calc_passcheck($password, $userinfo['passsalt'])) == strtolower($userinfo['passcheck'])) {
// login
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
qa_set_logged_in_user($inuserid, $userinfo['handle'], $remember ? true : false);
return $userinfo;
} else {
$this->error = new IXR_Error(1512, qa_lang('users/password_wrong'));
}
} else {
$this->error = new IXR_Error(1512, qa_lang('users/user_not_found'));
}
} else {
$this->error = new IXR_Error(1512, qa_lang('users/login_limit'));
}
qa_limits_increment(null, QA_LIMIT_LOGINS);
// log on failure
return false;
}