當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。