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


PHP Net_LDAP2::errorMessage方法代码示例

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


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

示例1: validate_user_ldap

	function validate_user_ldap($user, $pass)
	{
		if (!$pass) { // An LDAP password cannot be empty. Treat specially so that Tiki does *NOT* unintentionally request an unauthenticated bind.
			return PASSWORD_INCORRECT;
		}

		global $prefs;
		global $logslib;

		// First connection on the ldap server in anonymous, now we can search the real name of the $user
		// It's required to pass in param the username & password because the username is used to determine the realname (dn)
		$this->init_ldap($user, $pass);

		$err = $this->ldap->bind();
		if (is_int($err)) {
			$err=Net_LDAP2::errorMessage($err);
		}

		// Change the default bind_type to use the full, call get_user_attributes function to use the realname (dn) in the credentials test
		$this->ldap->setOption('bind_type', 'full');
		$this->ldap->get_user_attributes();

		// Credentials test! To test it we force the reconnection.
		$err = $this->ldap->bind(true);
		if (is_int($err)) {
				$err = Net_LDAP2::errorMessage($err);
		}

		switch($err) {
			case 'LDAP_INVALID_CREDENTIALS':
				return PASSWORD_INCORRECT;

			case 'LDAP_INVALID_SYNTAX':
			case 'LDAP_NO_SUCH_OBJECT':
			case 'LDAP_INVALID_DN_SYNTAX':
				if ($prefs['auth_ldap_debug'] == 'y')
					$logslib->add_log('ldap', 'Error'.$err);
				return USER_NOT_FOUND;

			case 'LDAP_SUCCESS':
				if ($prefs['auth_ldap_debug'] == 'y')
					$logslib->add_log('ldap', 'Bind successful.');
				return USER_VALID;

		default:
			if ($prefs['auth_ldap_debug'] == 'y')
				$logslib->add_log('ldap', 'Error'.$err);
			return SERVER_ERROR;
		}

		// this should never happen
		die('Assertion failed ' . __FILE__ . ':' . __LINE__);
	}
开发者ID:railfuture,项目名称:tiki-website,代码行数:53,代码来源:userslib.php

示例2: __construct

 /**
  * Net_LDAP2_Error constructor.
  *
  * @param string  $message   String with error message.
  * @param integer $code      Net_LDAP2 error code
  * @param integer $mode      what "error mode" to operate in
  * @param mixed   $level     what error level to use for $mode & PEAR_ERROR_TRIGGER
  * @param mixed   $debuginfo additional debug info, such as the last query
  *
  * @access public
  * @see PEAR_Error
  */
 public function __construct($message = 'Net_LDAP2_Error', $code = NET_LDAP2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
 {
     if (is_int($code)) {
         $this->PEAR_Error($message . ': ' . Net_LDAP2::errorMessage($code), $code, $mode, $level, $debuginfo);
     } else {
         $this->PEAR_Error("{$message}: {$code}", NET_LDAP2_ERROR, $mode, $level, $debuginfo);
     }
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:20,代码来源:LDAP2.php


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