当前位置: 首页>>代码示例>>PHP>>正文


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怎么用?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;
 }
开发者ID:naszaklasa,项目名称:question2answer-nk-plugin,代码行数:14,代码来源:qa-nkconnect.php

示例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');
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:18,代码来源:qa-app-users-edit.php

示例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 {
开发者ID:ruuttt,项目名称:question2answer,代码行数:31,代码来源:qa-page-login.php

示例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);
}
开发者ID:robomartin,项目名称:Q2A-Mod-2,代码行数:34,代码来源:qa-app-users-edit.php

示例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;
 }
开发者ID:doekia,项目名称:q2a-xml-rpc,代码行数:35,代码来源:qa-xml-rpc-server.php


注:本文中的qa_db_user_find_by_handle函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。