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


PHP PearDatabase::raw_query_result_rowdata方法代码示例

本文整理汇总了PHP中PearDatabase::raw_query_result_rowdata方法的典型用法代码示例。如果您正苦于以下问题:PHP PearDatabase::raw_query_result_rowdata方法的具体用法?PHP PearDatabase::raw_query_result_rowdata怎么用?PHP PearDatabase::raw_query_result_rowdata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PearDatabase的用法示例。


在下文中一共展示了PearDatabase::raw_query_result_rowdata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doLogin

 /**
  * Checks the config.php AUTHCFG value for login type and forks off to the proper module
  *
  * @param string $user_password - The password of the user to authenticate
  * @return true if the user is authenticated, false otherwise
  */
 function doLogin($userPassword)
 {
     $userName = $this->column_fields["user_name"];
     $userid = $this->retrieve_user_id($userName);
     $this->log->debug("Start of authentication for user: {$userName}");
     $result = $this->db->pquery('SELECT * FROM yetiforce_auth');
     $auth = [];
     for ($i = 0; $i < $this->db->num_rows($result); $i++) {
         $row = $this->db->raw_query_result_rowdata($result, $i);
         $auth[$row['type']][$row['param']] = $row['value'];
     }
     if ($auth['ldap']['active'] == 'true') {
         $this->log->debug('Start LDAP authentication');
         $users = explode(',', $auth['ldap']['users']);
         if (in_array($userid, $users)) {
             $bind = FALSE;
             $port = $auth['ldap']['port'] == '' ? 389 : $auth['ldap']['port'];
             $ds = @ldap_connect($auth['ldap']['server'], $port);
             if (!$ds) {
                 $this->log->error('Error LDAP authentication: Could not connect to LDAP server.');
             }
             @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
             // Try version 3.  Will fail and default to v2.
             @ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
             if ($port != 636) {
                 @ldap_start_tls($ds);
             }
             $bind = @ldap_bind($ds, $userName . $auth['ldap']['domain'], $userPassword);
             if (!$bind) {
                 $this->log->error('LDAP authentication: LDAP bind failed.');
             }
             return $bind;
         } else {
             $this->log->error("{$userName} user does not belong to the LDAP");
         }
         $this->log->debug('End LDAP authentication');
     }
     //Default authentication
     $this->log->debug('Using integrated/SQL authentication');
     $query = "SELECT crypt_type, user_name FROM {$this->table_name} WHERE user_name=?";
     $result = $this->db->pquery($query, [$userName]);
     if ($result->rowCount() != 1) {
         $this->log->error("User not found: {$userName}");
         return FALSE;
     }
     $cryptType = $this->db->query_result($result, 0, 'crypt_type');
     $this->column_fields["user_name"] = $this->db->query_result($result, 0, 'user_name');
     $encryptedPassword = $this->encrypt_password($userPassword, $cryptType);
     $query = "SELECT 1 from {$this->table_name} where user_name=? AND user_password=? AND status = ?";
     $result = $this->db->pquery($query, [$userName, $encryptedPassword, 'Active']);
     if ($result->rowCount() == 1) {
         $this->log->debug("Authentication OK. User: {$userName}");
         return TRUE;
     }
     $this->log->debug("Authentication failed. User: {$userName}");
     return FALSE;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:63,代码来源:Users.php


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