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