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

PHP ldap_errno函数代码示例

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

本文整理汇总了PHP中ldap_errno函数的典型用法代码示例。如果您正苦于以下问题:PHP ldap_errno函数的具体用法?PHP ldap_errno怎么用?PHP ldap_errno使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: loadPage

 protected function loadPage()
 {
     if (!ldap_control_paged_result($this->connection, $this->pageSize, true, $this->pageToken)) {
         throw new SearchException("Unable to set paged control pageSize: " . $this->pageSize);
     }
     $search = ldap_search($this->connection, $this->baseDn, $this->filter, is_array($this->attributes) ? $this->attributes : []);
     if (!$search) {
         // Something went wrong in search
         throw Connection::createLdapSearchException(ldap_errno($this->connection), $this->baseDn, $this->filter, $this->pageSize);
     }
     $this->entries = ldap_get_entries($this->connection, $search);
     $this->entriesPosition = 0;
     if (!$this->entries) {
         throw Connection::createLdapSearchException(ldap_errno($this->connection), $this->baseDn, $this->filter, $this->pageSize);
     }
     // check if on first page
     if (empty($this->pageToken)) {
         $this->currentPage = 0;
     } else {
         $this->currentPage++;
     }
     // Ok go to next page
     ldap_control_paged_result_response($this->connection, $search, $this->pageToken);
     if (empty($this->pageToken)) {
         $this->isLastPage = true;
     }
 }
开发者ID:81square,项目名称:ldap,代码行数:27,代码来源:SearchIterator.php


示例2: connect

 /**
  * Tries to connect to an LDAP server.
  *
  * If a connection is currently open, it is closed.
  *
  * All PHP errors triggered by ldap_* calls are wrapped in exceptions and thrown.
  *
  * @param string $serverHostName The hostname of the LDAP server.
  * @param int $port The server port to use.
  * @param int $timeout The timeout in seconds of the network connection.
  * @throws Exception If an error occurs during the `ldap_connect` call or if there is a connection
  *                   issue during the subsequent anonymous bind.
  */
 public function connect($serverHostName, $port = ServerInfo::DEFAULT_LDAP_PORT, $timeout = self::DEFAULT_TIMEOUT_SECS)
 {
     $this->closeIfCurrentlyOpen();
     Log::debug("Calling ldap_connect('%s', %s)", $serverHostName, $port);
     $this->connectionResource = ldap_connect($serverHostName, $port);
     ldap_set_option($this->connectionResource, LDAP_OPT_PROTOCOL_VERSION, 3);
     ldap_set_option($this->connectionResource, LDAP_OPT_REFERRALS, 0);
     ldap_set_option($this->connectionResource, LDAP_OPT_NETWORK_TIMEOUT, $timeout);
     Log::debug("ldap_connect result is %s", $this->connectionResource);
     // ldap_connect will not always try to connect to the server, so execute a bind
     // to test the connection
     try {
         ldap_bind($this->connectionResource);
         Log::debug("anonymous ldap_bind call finished; connection ok");
     } catch (Exception $ex) {
         // if the error was due to a connection error, rethrow, otherwise ignore it
         $errno = ldap_errno($this->connectionResource);
         Log::debug("anonymous ldap_bind returned error '%s'", $errno);
         if (!in_array($errno, self::$initialBindErrorCodesToIgnore)) {
             throw $ex;
         }
     }
     if (!$this->isOpen()) {
         // sanity check
         throw new Exception("sanity check failed: ldap_connect did not return a connection resource!");
     }
 }
开发者ID:polytan02,项目名称:dev_piwik_ynh,代码行数:40,代码来源:Client.php


示例3: _processLogin

 /**
  * 
  * Verifies a username handle and password.
  * 
  * @return mixed An array of verified user information, or boolean false
  * if verification failed.
  * 
  * 
  */
 protected function _processLogin()
 {
     // connect
     $conn = @ldap_connect($this->_config['uri']);
     // did the connection work?
     if (!$conn) {
         throw $this->_exception('ERR_CONNECTION_FAILED', $this->_config);
     }
     // upgrade to LDAP3 when possible
     @ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
     // filter the handle to prevent LDAP injection
     $regex = '/[^' . $this->_config['filter'] . ']/';
     $this->_handle = preg_replace($regex, '', $this->_handle);
     // bind to the server
     $rdn = sprintf($this->_config['format'], $this->_handle);
     $bind = @ldap_bind($conn, $rdn, $this->_passwd);
     // did the bind succeed?
     if ($bind) {
         ldap_close($conn);
         return array('handle' => $this->_handle);
     } else {
         $this->_err = @ldap_errno($conn) . " " . @ldap_error($conn);
         ldap_close($conn);
         return false;
     }
 }
开发者ID:agentile,项目名称:foresmo,代码行数:35,代码来源:Ldap.php


示例4: __construct

 public function __construct($message, $ldapLink, $dn = null)
 {
     if ($ldapLink instanceof server) {
         $ldapLink = $ldapLink->getLink();
     }
     parent::__construct(sprintf('LDAP exception (%s): %s (%s)', $dn ? $dn : 'global', $message, @ldap_error($ldapLink), @ldap_errno($ldapLink)));
 }
开发者ID:cepharum,项目名称:txf,代码行数:7,代码来源:protocol_exception.php


示例5: install_etape_ldap4_dist

function install_etape_ldap4_dist()
{
    $adresse_ldap = _request('adresse_ldap');
    $login_ldap = _request('login_ldap');
    $pass_ldap = _request('pass_ldap');
    $port_ldap = _request('port_ldap');
    $base_ldap = _request('base_ldap');
    $base_ldap_text = _request('base_ldap_text');
    if (!$base_ldap) {
        $base_ldap = $base_ldap_text;
    }
    echo install_debut_html();
    $ldap_link = ldap_connect($adresse_ldap, $port_ldap);
    @ldap_bind($ldap_link, $login_ldap, $pass_ldap);
    // Essayer de verifier le chemin fourni
    $r = @ldap_compare($ldap_link, $base_ldap, "objectClass", "");
    $fail = ldap_errno($ldap_link) == 32;
    if ($fail) {
        echo info_etape(_T('info_chemin_acces_annuaire')), info_progression_etape(3, 'etape_ldap', 'install/', true), "<div class='error'><p><b>" . _T('avis_operation_echec') . "</b></p><p>" . _T('avis_chemin_invalide_1'), " (<tt>" . htmlspecialchars($base_ldap) . "</tt>) " . _T('avis_chemin_invalide_2') . "</p></div>";
    } else {
        info_etape(_T('info_reglage_ldap'));
        echo info_progression_etape(4, 'etape_ldap', 'install/');
        $statuts = liste_statuts_ldap();
        $statut_ldap = defined('_INSTALL_STATUT_LDAP') ? _INSTALL_STATUT_LDAP : $GLOBALS['liste_des_statuts']['info_redacteurs'];
        $res = install_propager(array('adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap')) . "<input type='hidden' name='etape' value='ldap5' />" . "<input type='hidden' name='base_ldap' value='" . htmlentities($base_ldap) . "' />" . fieldset(_T('info_statut_utilisateurs_1'), array('statut_ldap' => array('label' => _T('info_statut_utilisateurs_2') . '<br />', 'valeur' => $statut_ldap, 'alternatives' => $statuts))) . install_ldap_correspondances() . bouton_suivant();
        echo generer_form_ecrire('install', $res);
    }
    echo install_fin_html();
}
开发者ID:nursit,项目名称:SPIP,代码行数:29,代码来源:etape_ldap4.php


示例6: parse

 /**
  * @return string[]
  * @throws ValueRetrievalFailureException
  */
 public function parse()
 {
     if (!ldap_parse_reference($this->link, $this->reference, $referrals)) {
         throw new ValueRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
     }
     return $referrals;
 }
开发者ID:daverandom,项目名称:ldapi,代码行数:11,代码来源:Reference.php


示例7: getFirstEntry

 /**
  * Returns the first entry in the result set.
  * 
  * @throws \gossi\ldap\LdapException If the read fails.
  * @return \gossi\ldap\LdapEntry The new LdapEntry.
  */
 public function getFirstEntry()
 {
     $this->pointer = ldap_first_entry($this->conn, $this->result);
     if (ldap_errno($this->conn)) {
         throw new LdapException(ldap_error($this->conn), ldap_errno($this->conn));
     }
     return new LdapEntry($this->conn, $this->pointer);
 }
开发者ID:gossi,项目名称:ldap,代码行数:14,代码来源:LdapResult.php


示例8: __construct

 function __construct($arg, $code = 0)
 {
     if (is_resource($arg)) {
         $errno = ldap_errno($arg);
         $msg = ldap_err2str($errno);
     } else {
         $errno = $code;
         $msg = $arg;
     }
     error_log("LDAP Error {$errno}: {$msg}");
     parent::__construct($msg, $errno);
 }
开发者ID:btalayminaei,项目名称:DGSecurity,代码行数:12,代码来源:ldap.php


示例9: __construct

 public function __construct($message, $ldap = NULL)
 {
     if (is_resource($ldap)) {
         $error = ldap_error($ldap);
         if ($error) {
             parent::__construct($message . '. ' . $error, ldap_errno($ldap));
         } else {
             parent::__construct($message);
         }
     } else {
         parent::__construct($message);
     }
 }
开发者ID:jacekkow,项目名称:qa-cas-ldap-auth,代码行数:13,代码来源:ldap.php


示例10: fetch

 /**
  * 
  * Fetch roles for a user.
  * 
  * @param string $handle Username to get roles for.
  * 
  * @return array An array of roles discovered in LDAP.
  * 
  */
 public function fetch($handle)
 {
     // connect
     $conn = @ldap_connect($this->_config['url']);
     // did the connection work?
     if (!$conn) {
         throw $this->_exception('ERR_CONNECTION_FAILED', array('url' => $this->_config['url']));
     }
     // upgrade to LDAP3 when possible
     @ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
     // bind to the server
     if ($this->_config['binddn']) {
         // authenticated bind
         $bind = @ldap_bind($conn, $this->_config['binddn'], $this->_config['bindpw']);
     } else {
         // anonumous bind
         $bind = @ldap_bind($conn);
     }
     // did we bind to the server?
     if (!$bind) {
         // not using $this->_exception() because we need fine control
         // over the error text
         throw Solar::exception(get_class($this), @ldap_errno($conn), @ldap_error($conn), array($this->_config));
     }
     // search for the groups
     $filter = sprintf($this->_config['filter'], $handle);
     $attrib = (array) $this->_config['attrib'];
     $result = ldap_search($conn, $this->_config['basedn'], $filter, $attrib);
     // get the first entry from the search result and free the result.
     $entry = ldap_first_entry($conn, $result);
     ldap_free_result($result);
     // now get the data from the entry and close the connection.
     $data = ldap_get_attributes($conn, $entry);
     ldap_close($conn);
     // go through the attribute data and add to the list. only
     // retain numeric keys; the ldap entry will have some
     // associative keys that are metadata and not useful to us here.
     $list = array();
     foreach ($attrib as $attr) {
         if (isset($data[$attr]) && is_array($data[$attr])) {
             foreach ($data[$attr] as $key => $val) {
                 if (is_int($key)) {
                     $list[] = $val;
                 }
             }
         }
     }
     // done!
     return $list;
 }
开发者ID:kalkin,项目名称:solarphp,代码行数:59,代码来源:Ldap.php


示例11: getfromDn

 public function getfromDn($dn, $noassoc = false)
 {
     $dn = $this->adescape($dn);
     $filter = "(&(objectCategory=group)(distinguishedname={$dn}))";
     $result = ldap_search($this->con, $this->dn, $filter, $this->attributes);
     if (ldap_errno($this->con)) {
         throw new searchException('Unable to conduct search: ' . ldap_error($this->con));
     }
     if (ldap_count_entries($this->con, $result) == 0) {
         $result = ldap_search($this->con2, $this->dn2, $filter, $this->attributes);
     }
     if (ldap_errno($this->con2)) {
         throw new searchException('Unable to conduct search: ' . ldap_error($this->con2));
     }
     return $this->parseResult($result, $noassoc);
 }
开发者ID:nephie,项目名称:AZL-website,代码行数:16,代码来源:adgroupModel.php


示例12: throwException

 /**
  *
  * @throws BadSearchFilterException
  * @throws NoSuchObjectException
  * @throws InvalidCredentialException
  * @throws AlreadyExistsException
  * @throws LdapException
  */
 public static function throwException(Connection $conn)
 {
     $error = ldap_error($conn->getResource());
     $code = ldap_errno($conn->getResource());
     switch ($code) {
         case -7:
             throw new BadSearchFilterException($error, $code);
         case 32:
             throw new NoSuchObjectException($error, $code);
         case 49:
             throw new InvalidCredentialException($error, $code);
         case 68:
             throw new AlreadyExistsException($error, $code);
     }
     throw new LdapException($error, $code);
 }
开发者ID:mangati,项目名称:php-ldap,代码行数:24,代码来源:ErrorHandler.php


示例13: connect

 /**
  * Connects to an LDAP server specified by $uri, with admin $user and $password.
  *
  * Returns a resource which can be used in LDAP functions like add, delete, search.
  *
  * @param string $uri Uri for LDAP, such as 'ldap://example.com'
  * @param string $format Format for an entry, like 'cn=%s,dc=example,dc=com'. %s is a literal placeholder for username
  * @param string $user Admin username
  * @param string $password Password for admin
  * @return resource
  */
 public static function connect($uri, $format, $user, $password)
 {
     if (!extension_loaded('ldap')) {
         die('LDAP extension is not loaded.');
     }
     $connection = ldap_connect($uri);
     if (!$connection) {
         throw new Exception("Could not connect to host '{$uri}'");
     }
     ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3);
     @ldap_bind($connection, sprintf($format, $user), $password);
     $err = ldap_errno($connection);
     switch ($err) {
         case 0x51:
             // LDAP_SERVER_DOWN
         // LDAP_SERVER_DOWN
         case 0x52:
             // LDAP_LOCAL_ERROR
         // LDAP_LOCAL_ERROR
         case 0x53:
             // LDAP_ENCODING_ERROR
         // LDAP_ENCODING_ERROR
         case 0x54:
             // LDAP_DECODING_ERROR
         // LDAP_DECODING_ERROR
         case 0x55:
             // LDAP_TIMEOUT
         // LDAP_TIMEOUT
         case 0x56:
             // LDAP_AUTH_UNKNOWN
         // LDAP_AUTH_UNKNOWN
         case 0x57:
             // LDAP_FILTER_ERROR
         // LDAP_FILTER_ERROR
         case 0x58:
             // LDAP_USER_CANCELLED
         // LDAP_USER_CANCELLED
         case 0x59:
             // LDAP_PARAM_ERROR
         // LDAP_PARAM_ERROR
         case 0x5a:
             // LDAP_NO_MEMORY
             throw new Exception("Could not connect to host '{$uri}'. (0x" . dechex($err) . ")");
             break;
     }
     return $connection;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:58,代码来源:setup_accounts.php


示例14: init

 function init()
 {
     try {
         write_log('identiteam', 'Initialising');
         # Load default config, and merge with users' settings
         $this->load_config('config-default.inc.php');
         $this->load_config('config.inc.php');
         $this->app = rcmail::get_instance();
         $this->config = $this->app->config->get('identiteam');
         # Load LDAP & mail config at once
         $this->ldap = $this->config['ldap'];
         $this->mail = $this->config['mail'];
         $this->server = $this->ldap['server'];
         $this->referr = $this->ldap['referrals'];
         $this->b_user = $this->ldap['bind_user'];
         $this->b_pass = $this->ldap['bind_pass'];
         $this->filter = $this->ldap['filter'];
         $this->domain = $this->ldap['domain'];
         # Get these fields
         $this->fields = explode(',', $this->ldap['fields']);
         array_push($this->fields, $this->ldap['extraEmailField']);
         $this->conn = ldap_connect($this->server);
         if (is_resource($this->conn)) {
             ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3);
             ldap_set_option($this->conn, LDAP_OPT_REFERRALS, $this->referr);
             $bound = ldap_bind($this->conn, $this->b_user, $this->b_pass);
             if ($bound) {
                 // Create signature
                 $this->add_hook('user2email', array($this, 'user2email'));
                 $this->initialised = true;
             } else {
                 $log = sprintf("Bind to server '%s' failed. Con: (%s), Error: (%s)", $this->server, $this->conn, ldap_errno($this->conn));
                 write_log('identiteam', $log);
             }
         } else {
             $log = sprintf("Connection to the server failed: (Error=%s)", ldap_errno($this->conn));
             write_log('identiteam', $log);
         }
     } catch (Exception $exc) {
         write_log('identiteam', 'Fail to initialise: ' . $exc->getMessage());
     }
     if ($this->initialised) {
         write_log('identiteam', 'Initialised');
     }
 }
开发者ID:zsmj513,项目名称:Roundcube-Plugins,代码行数:45,代码来源:identiteam.php


示例15: authenticate

 public function authenticate($ps_username, $ps_password = '', $pa_options = null)
 {
     $vo_bind = $this->bindToDirectory($ps_username, $ps_password);
     if (!$vo_bind) {
         if (ldap_get_option($this->getLinkIdentifier(), 0x32, $extended_error)) {
             $vs_bind_rdn = $this->getProcessedConfigValue("ldap_bind_rdn_format", $ps_username, "", "");
             caLogEvent("ERR", "LDAP ERROR (" . ldap_errno($this->getLinkIdentifier()) . ") {$extended_error} [{$vs_bind_rdn}]", "OpenLDAP::Authenticate");
         }
         return false;
     }
     // check group membership
     if (!$this->hasRequiredGroupMembership($ps_username)) {
         return false;
     }
     // user role and group membership syncing with directory
     $this->syncWithDirectory($ps_username);
     return true;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:18,代码来源:AbstractLDAPAuthAdapter.php


示例16: retrieveResponse

 protected function retrieveResponse()
 {
     $response = $this->initResponse();
     $response->setCode($this->errorNo);
     $response->setResponseError($this->errorMsg);
     if (!$this->filter) {
         return $response;
     }
     $ds = $this->connectToServer();
     if (!$ds) {
         $response->setResponseError("Could not connect to LDAP server");
         return $response;
     }
     if ($this->adminDN) {
         if (!ldap_bind($ds, $this->adminDN, $this->adminPassword)) {
             Kurogo::log(LOG_WARNING, "Error binding to LDAP Server {$this->host} for {$this->adminDN}: " . ldap_error($ds), 'data');
             $response->setResponseError("Could not connect to LDAP server");
             return $response;
         }
     }
     // suppress warnings on non-dev servers
     // about searches that go over the result limit
     if (!$this->debugMode) {
         $error_reporting = ini_get('error_reporting');
         error_reporting($error_reporting & ~E_WARNING);
     }
     if ($this->filter instanceof LDAPFilter) {
         $result = @ldap_search($ds, $this->searchBase, strval($this->filter), $this->getAttributes(), 0, 0, $this->searchTimelimit);
     } else {
         $result = @ldap_read($ds, $this->filter, "(objectclass=*)", $this->getAttributes(), 0, 0, $this->readTimelimit);
     }
     $error_code = ldap_errno($ds);
     $response->setResponse($result);
     $response->setCode($error_code);
     $response->setContext('ldap', $ds);
     if ($error_code) {
         $response->setResponseError($this->generateErrorMessage($error_code));
     }
     if (!$this->debugMode) {
         error_reporting($error_reporting);
     }
     return $response;
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:43,代码来源:LDAPPeopleRetriever.php


示例17: authenticate

 /**
  *  Authenticate  user again LDAP directory (Bind)
  *  2 options :
  * 		Authenticate directly with uname in the DN
  * 		Authenticate with manager, search the dn
  *
  * @param string $uname Username
  * @param string $pwd Password
  *
  * @return bool
  */
 public function authenticate($uname, $pwd = null)
 {
     $authenticated = false;
     if (!extension_loaded('ldap')) {
         $this->setErrors(0, _AUTH_LDAP_EXTENSION_NOT_LOAD);
         return $authenticated;
     }
     $this->_ds = ldap_connect($this->ldap_server, $this->ldap_port);
     if ($this->_ds) {
         ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_version);
         ldap_set_option($this->_ds, LDAP_OPT_REFERRALS, 0);
         if ($this->ldap_use_TLS) {
             // We use TLS secure connection
             if (!ldap_start_tls($this->_ds)) {
                 $this->setErrors(0, _AUTH_LDAP_START_TLS_FAILED);
             }
         }
         // If the uid is not in the DN we proceed to a search
         // The uid is not always in the dn
         $userUPN = $this->getUPN($uname);
         if (!$userUPN) {
             return false;
         }
         // We bind as user to test the credentials
         $authenticated = ldap_bind($this->_ds, $userUPN, $this->cp1252_to_utf8(stripslashes($pwd)));
         if ($authenticated) {
             // We load the User database
             $dn = $this->getUserDN($uname);
             if ($dn) {
                 return $this->loadicms_member_user_Object($dn, $uname, $pwd);
             } else {
                 return false;
             }
         } else {
             $this->setErrors(ldap_errno($this->_ds), ldap_err2str(ldap_errno($this->_ds)) . '(' . $userUPN . ')');
         }
     } else {
         $this->setErrors(0, _AUTH_LDAP_SERVER_NOT_FOUND);
     }
     @ldap_close($this->_ds);
     return $authenticated;
 }
开发者ID:nao-pon,项目名称:impresscms,代码行数:53,代码来源:Ads.php


示例18: authenticate

 function authenticate($params)
 {
     assert('isset($params["user"]) && isset($params["password"])');
     $con = false;
     if (($domain = getConfiguration('auth.ldap.domain')) !== false) {
         $port = (int) getConfiguration('auth.ldap.port', self::LDAP_DEFAULT_PORT);
         $con = ldap_connect($domain, $port);
     }
     if ($con === false) {
         throw new Exception(__METHOD__ . ": Failed to connect to {$domain} in port {$port}");
     }
     $authUser = $user = $this->ldap_escape($params['user']);
     $pass = $this->ldap_escape($params['password']);
     $ldapDomainName = getConfiguration('auth.ldap.domain.name');
     if ($ldapDomainName) {
         $authUser = $ldapDomainName . '\\' . $authUser;
     }
     debug(__METHOD__ . ": Trying to authenticate {$authUser} against {$domain}");
     if (ldap_bind($con, $authUser, $pass)) {
         // We're assuming that the email used is as the user name
         $email = $email = Utils::buildEmail($user);
         // Close the connection - we don't need it any more
         ldap_unbind($con);
         // Fetch contact
         $contact = DatabaseHelper::getInstance()->getContactByEmail($email);
         if ($contact !== false) {
             return array('Id' => $contact['Id'], 'Role' => $contact['Role']);
         } else {
             // Contact is not in the database - we better create it
             // TODO: Put the option to read data
             return array('Id' => DatabaseHelper::getInstance()->addContact('', '', $email, ROLE_IDENTIFIED), 'Role' => ROLE_IDENTIFIED);
         }
     } else {
         $errCode = ldap_errno($con);
         if ($errCode == self::LDAP_INAPPROPRIATE_AUTH || $errCode == self::LDAP_INVALID_CREDENTIALS) {
             // Invalid credentials - simply fail
             return false;
         }
         // Internal error
         throw new Exception(__METHOD__ . " : LDAP error: " . ldap_err2str($errCode));
     }
 }
开发者ID:atrakroo,项目名称:carpool-1,代码行数:42,代码来源:AuthenticationHelperLdap.php


示例19: moveuser

function moveuser()
{
    $u = new user($_POST["userid"]);
    $dn = $u->dn;
    $gplist = $u->Groups_list();
    if (preg_match("#^(.+?),#", $dn, $re)) {
        $newRdn = $re[1];
    } else {
        $newRdn = "cn={$_POST["userid"]}";
    }
    $ldap = new clladp();
    $newParent = "ou=users,ou={$_POST["nextou"]},dc=organizations,{$ldap->suffix}";
    if (!ldap_rename($ldap->ldap_connection, $dn, $newRdn, $newParent, true)) {
        echo 'Error number ' . ldap_errno($ldap->ldap_connection) . "\nAction:LDAP Ldap_rename\ndn:{$dn} -> {$newRdn},{$newParent}\n" . ldap_err2str(ldap_errno($ldap->ldap_connection));
        return;
    }
    while (list($gid, $name) = each($gplist)) {
        $gp = new groups($gid);
        $gp->DeleteUserFromThisGroup($_POST["userid"]);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:21,代码来源:domains.edit.user.moveorg.php


示例20: delete_ldap

function delete_ldap($dn, $connect, $recursive = false)
{
    if ($recursive == false) {
        if (!@ldap_delete($connect, $dn)) {
            echo "Deleting {$dn}...\n";
            echo "ERROR: ldap_delete \"{$dn}\"" . ldap_err2str(ldap_errno($connect)) . "\n";
            return false;
        }
    }
    $sr = @ldap_list($connect, $dn, "ObjectClass=*");
    if ($sr) {
        $info = @ldap_get_entries($connect, $sr);
        for ($i = 0; $i < $info['count']; $i++) {
            $result = delete_ldap($info[$i]['dn'], $connect, $recursive);
            if (!$result) {
                return $result;
            }
        }
        return delete_ldap($dn, $connect, false);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:21,代码来源:cron.endoflife.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ldap_error函数代码示例发布时间:2022-05-15
下一篇:
PHP ldap_err2str函数代码示例发布时间: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