• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP qa_db_user_find_by_handle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP qa_db_user_points_selectspec函数代码示例发布时间:2022-05-15
下一篇:
PHP qa_db_user_find_by_email函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap