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

PHP ldap_next_entry函数代码示例

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

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



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

示例1: verify

 function verify($cert, $dn)
 {
     $conn = ldap_connect($this->LDAP_HOST);
     if (!$conn) {
         return false;
     }
     if (!ldap_bind($conn)) {
         return false;
     }
     $resultset = ldap_search($conn, "c=EE", "(serialNumber=38212200301)");
     if (!$resultset) {
         echo "No recs";
         return false;
     }
     $rec = ldap_first_entry($conn, $resultset);
     while ($rec !== false) {
         $values = ldap_get_values($conn, $rec, 'usercertificate;binary');
         $certificate = "-----BEGIN CERTIFICATE-----\n" . chunk_split(base64_encode($values[0]), 64, "\n") . "-----END CERTIFICATE-----\n";
         if (strcmp($cert, $certificate) == 0) {
             return "Found";
         }
         $rec = ldap_next_entry($conn, $rec);
     }
     // Not found a record with a matching certificate
     return false;
 }
开发者ID:raisty,项目名称:eid-webauth-samples,代码行数:26,代码来源:ldap.php


示例2: fetchEntry

 /**
  * @return mixed resource
  */
 public function fetchEntry()
 {
     if (!$this->result_resource) {
         return null;
     }
     if (null === $this->entry_resource) {
         $this->entry_resource = ldap_first_entry($this->resource, $this->result_resource);
     } else {
         $this->entry_resource = ldap_next_entry($this->resource, $this->entry_resource);
     }
     if (!$this->entry_resource) {
         return null;
     }
     $dn = ldap_get_dn($this->resource, $this->entry_resource);
     $rawAttributes = ldap_get_attributes($this->resource, $this->entry_resource);
     $count = $rawAttributes['count'];
     $attributes = array();
     for ($i = 0; $i < $count; $i++) {
         $attribute = $rawAttributes[$i];
         $values = array();
         $subCount = $rawAttributes[$attribute]['count'];
         for ($j = 0; $j < $subCount; $j++) {
             $values[] = $rawAttributes[$attribute][$j];
         }
         $attributes[$attribute] = $values;
     }
     $object = new Object($dn, $attributes);
     return $object;
 }
开发者ID:heiglandreas,项目名称:ldap,代码行数:32,代码来源:SearchResultProxy.php


示例3: fetch_row

 public function fetch_row()
 {
     if ($this->get_opt('fetch_pos')) {
         return ldap_next_entry($this->handle, $this->resource);
     } else {
         return ldap_first_entry($this->handle, $this->resource);
     }
 }
开发者ID:codifyllc,项目名称:phpopenfw,代码行数:8,代码来源:dr_ldap.class.php


示例4: nextEntry

 /**
  * @return Entry|null
  * @throws EntryRetrievalFailureException
  */
 public function nextEntry()
 {
     if (!($entry = ldap_next_entry($this->link, $this->entry))) {
         if (0 !== ($errNo = ldap_errno($this->link))) {
             throw new EntryRetrievalFailureException(ldap_error($this->link), $errNo);
         }
         return null;
     }
     return new Entry($this->link, $entry);
 }
开发者ID:daverandom,项目名称:ldapi,代码行数:14,代码来源:Entry.php


示例5: readUsers

 public static function readUsers($ldapconn)
 {
     $users = array();
     $search = ldap_list($ldapconn, USER_DN, User::FILTER_USERS, array("cn", "mail", "displayName", "sn", "givenName", "memberOf"));
     if (ldap_count_entries($ldapconn, $search) > 0) {
         $entry = ldap_first_entry($ldapconn, $search);
         do {
             $users[] = User::readFromLdapEntry($ldapconn, $entry);
         } while ($entry = ldap_next_entry($ldapconn, $entry));
     }
     return $users;
 }
开发者ID:tmaex,项目名称:useradmin,代码行数:12,代码来源:user.inc.php


示例6: getNextEntry

 /**
  * Returns the next entry in the result set or false wether there are no more entries.
  * 
  * @return \gossi\ldap\LdapEntry The new LdapEntry.
  */
 public function getNextEntry()
 {
     if ($this->pointer == null) {
         return $this->getFirstEntry();
     }
     $this->pointer = ldap_next_entry($this->conn, $this->pointer);
     if ($this->pointer) {
         return new LdapEntry($this->conn, $this->pointer);
     } else {
         return false;
     }
 }
开发者ID:gossi,项目名称:ldap,代码行数:17,代码来源:LdapResult.php


示例7: iterarEntradas

 /**
  * Auxiliar directo de busqueda. Dado un ldap result, itera por el para conseguir sus datos
  * 
  * @param ldap result $busquedaLdap
  * @param array $atributos
  * @return boolean
  */
 private function iterarEntradas($busquedaLdap, array $atributos)
 {
     $datos = array();
     if ($entrada = ldap_first_entry($this->conexionLdap, $busquedaLdap)) {
         do {
             // Ejecutamos al menos una vez el mapeo de entradas con sus atributos, a menos
             // que no haya nada
             $datos[] = $this->mapa($atributos, $entrada);
         } while ($entrada = ldap_next_entry($this->conexionLdap, $entrada));
         return $datos;
     } else {
         return FALSE;
     }
 }
开发者ID:vtacius,项目名称:ldappm,代码行数:21,代码来源:ldapOperations.php


示例8: ldap_flatresults

 function ldap_flatresults($ad, $sr, $key = false)
 {
     for ($entry = ldap_first_entry($ad, $sr); $entry != false; $entry = ldap_next_entry($ad, $entry)) {
         $user = array();
         $attributes = ldap_get_attributes($ad, $entry);
         for ($i = $attributes['count']; $i-- > 0;) {
             $user[strtolower($attributes[$i])] = $attributes[$attributes[$i]][0];
         }
         if ($key && $user[$key]) {
             $users[strtolower($user[$key])] = $user;
         } else {
             $users[] = $user;
         }
     }
     return $users;
 }
开发者ID:bazo,项目名称:diplomovka,代码行数:16,代码来源:LDAPModel.php


示例9: getIterator

 public function getIterator()
 {
     $con = $this->connection->getResource();
     $search = $this->search->getResource();
     $current = ldap_first_entry($con, $search);
     if (0 === $this->count()) {
         return;
     }
     if (false === $current) {
         throw new LdapException(sprintf('Could not rewind entries array: %s', ldap_error($con)));
     }
     (yield $this->getSingleEntry($con, $current));
     while (false !== ($current = ldap_next_entry($con, $current))) {
         (yield $this->getSingleEntry($con, $current));
     }
 }
开发者ID:ayoah,项目名称:symfony,代码行数:16,代码来源:Collection.php


示例10: next

 /**
  * Retrieves next available entry from the search result set
  *
  * @return EntryInterface next entry if available, null otherwise
  */
 public function next()
 {
     if ($this->isEndReached) {
         return null;
     }
     if (null === $this->previous) {
         $this->previous = @ldap_first_entry($this->connection, $this->resultSet);
     } else {
         $this->previous = @ldap_next_entry($this->connection, $this->previous);
     }
     if (false === $this->previous) {
         $this->previous = null;
         $this->isEndReached = true;
         return null;
     }
     return new Entry($this->connection, $this->previous);
 }
开发者ID:81square,项目名称:ldap,代码行数:22,代码来源:Search.php


示例11: getUsers

 public function getUsers($filter = null)
 {
     if ($filter !== null) {
         $filter = "(&(objectClass=inetOrgPerson)(uid=" . addcslashes($filter, '()\\') . "))";
     } else {
         $filter = "(objectClass=inetOrgPerson)";
     }
     $resource = ldap_search($this->ldapconn, $this->ldapbasedn, $filter);
     ldap_sort($this->ldapconn, $resource, "uid");
     $entry = ldap_first_entry($this->ldapconn, $resource);
     $users = array();
     while ($entry) {
         $attributes = ldap_get_attributes($this->ldapconn, $entry);
         $users[] = $attributes["uid"][0];
         $entry = ldap_next_entry($this->ldapconn, $entry);
     }
     return $users;
 }
开发者ID:jungepiraten,项目名称:ucp,代码行数:18,代码来源:UserDatabase.class.php


示例12: fetch

 /**
  * Fetch the next record or return false if there's none.
  * 
  * @return Record 
  */
 public function fetch()
 {
     if (!isset($this->_numEntry)) {
         $this->_numEntry = 0;
         $this->_entryId = ldap_first_entry($this->_ldapConn->getLink(), $this->_searchId);
     } else {
         $this->_numEntry++;
         $this->_entryId = ldap_next_entry($this->_ldapConn->getLink(), $this->_entryId);
     }
     if (!$this->_entryId) {
         return false;
     }
     $record = new $this->fetchClass($this->_ldapConn, $this->_entryId);
     if (!is_a($record, 'GO\\Base\\Ldap\\Record')) {
         throw new Exception($this->fetchClass . ' is not a GO\\Base\\Ldap\\Record subclass');
     }
     return $record;
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:23,代码来源:Result.php


示例13: next

 /**
  * Get the next LDAP entry from search results.
  *
  * @return Entry|null
  *   Next LDAP entry or null if no entries left.
  */
 public function next()
 {
     if ($this->entryID === null) {
         $this->entryID = ldap_first_entry($this->ds, $this->sr);
     } else {
         $this->entryID = ldap_next_entry($this->ds, $this->entryID);
     }
     if (!$this->entryID) {
         return null;
     }
     $data = Utils::readEntry($this->ds, $this->entryID, $this->binaryFields);
     if (array_key_exists('nsRole', $data)) {
         $data['roles'] = Utils::getRoles($this->ds, $data);
     }
     $dn = ldap_get_dn($this->ds, $this->entryID);
     $rdn = Utils::getRDN($dn, $this->baseDN);
     return new Entry($this->ds, $rdn, $dn, $data);
 }
开发者ID:grom358,项目名称:php-ldap,代码行数:24,代码来源:SearchResults.php


示例14: next

 /**
  * @see ResultSet::next()
  */
 public function next()
 {
     if (!$this->entry) {
         $this->entry = ldap_first_entry($this->conn->getResource(), $this->result);
     }
     $this->entry = ldap_next_entry($this->conn->getResource(), $this->entry);
     if (!$this->entry) {
         $errno = mysql_errno($this->conn->getResource());
         if (!$errno) {
             // We've advanced beyond end of recordset.
             $this->afterLast();
             return false;
         } else {
             throw new SQLException("Error fetching result", mysql_error($this->conn->getResource()));
         }
     }
     $this->cursorPos++;
     return $this->entry;
 }
开发者ID:nmicht,项目名称:tlalokes-in-acst,代码行数:22,代码来源:LdapResultSet.php


示例15: get_ldap_attribute_for_various_data

 public function get_ldap_attribute_for_various_data($pAttributes, $ldapRequest)
 {
     $allResults = array();
     $ldapc = $this->ldap_conn;
     //ldap connection
     if (!is_array($pAttributes)) {
         throw new Exception("Argument is not an array", E_PARAM);
     }
     //search for multiple ldap attributes
     //search string is prefix notation
     $search = ldap_search($ldapc, LDAP_O . ", " . LDAP_C, $ldapRequest, $pAttributes);
     //get ldap attributes
     for ($entryID = ldap_first_entry($ldapc, $search); $entryID != false; $entryID = ldap_next_entry($ldapc, $entryID)) {
         foreach ($pAttributes as $attribute) {
             $value = ldap_get_values($ldapc, $entryID, $attribute);
             $result[$attribute] = $value[0];
         }
         $allResults[] = $result;
     }
     return $allResults;
 }
开发者ID:rolwi,项目名称:koala,代码行数:21,代码来源:lms_ldap.class.php


示例16: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  array  $credentials
  * @return bool
  */
 public function validateCredentials(UserContract $user, array $credentials)
 {
     $email = $credentials['email'];
     $password = $credentials['password'];
     $ldap_conn = ldap_connect($this->ldapConfig['host'], $this->ldapConfig['port']);
     $ldap_bind = ldap_bind($ldap_conn, $this->ldapConfig['user'], $this->ldapConfig['password']);
     try {
         // Find By Email
         $escEmail = ldap_escape($email, '', LDAP_ESCAPE_FILTER);
         $filter = "(&(uid=*)(|(mail=" . $escEmail . ")" . "(gosaMailAlternateAddress=" . $escEmail . ")))";
         $sr = ldap_search($ldap_conn, $this->ldapConfig['base'], $filter, []);
         if (!$sr) {
             return false;
         }
         $conn = ldap_connect($this->ldapConfig['host'], $this->ldapConfig['port']);
         $entry = ldap_first_entry($ldap_conn, $sr);
         while ($entry) {
             $dn = ldap_get_dn($ldap_conn, $entry);
             // Check Credentials
             // remove warnings for incorrect passwords
             $level = error_reporting();
             error_reporting($level & ~E_WARNING);
             try {
                 $bind = ldap_bind($conn, $dn, $password);
                 if ($bind) {
                     // successful
                     ldap_unbind($conn);
                     return true;
                 }
             } finally {
                 // restore warnings
                 error_reporting($level);
             }
             $entry = ldap_next_entry($ldap_conn, $entry);
         }
     } finally {
         ldap_unbind($ldap_conn);
     }
     return false;
 }
开发者ID:AlexRadch,项目名称:Laravel-LdapCredentials,代码行数:47,代码来源:ValidateLdapCredentials.php


示例17: next

 /**
  * Gets next entry
  *
  * @return  peer.ldap.LDAPEntry or NULL if nothing was found
  * @throws  peer.ldap.LDAPException in case of a read error
  */
 public function next()
 {
     // If we have reached the number of results reported by ldap_count_entries()
     // - see constructor, return FALSE without trying to read further. Trying
     // to read "past the end" results in LDAP error #84 (decoding error) in some
     // client/server constellations, which is then incorrectly reported as an error.
     if ($this->iteration[1] >= $this->size) {
         return null;
     }
     // Fetch the next entry. Return FALSE if it was the last one (where really,
     // we shouldn't be getting here)
     $entry = ldap_next_entry($this->conn, $this->iteration[0]);
     if (!$entry) {
         if ($e = ldap_errno($this->conn)) {
             throw new LDAPException('Could not fetch next result entry.', $e);
         }
         return null;
         // EOF
     }
     // Keep track how many etnries we have fetched so we stop once we
     // have reached this number - see above for explanation.
     $this->iteration = [$entry, ++$this->iteration[1]];
     return LDAPEntry::create(ldap_get_dn($this->conn, $entry), ldap_get_attributes($this->conn, $entry));
 }
开发者ID:xp-framework,项目名称:ldap,代码行数:30,代码来源:LDAPEntries.class.php


示例18: _getChildrenDns

 /**
  * Retrieve the immediate children DNs of the given $parentDn
  *
  * This method is used in recursive methods like {@see delete()}
  * or {@see copy()}
  *
  * @param  string|Zend_Ldap_Dn $parentDn
  * @return array of DNs
  */
 protected function _getChildrenDns($parentDn)
 {
     if ($parentDn instanceof Zend_Ldap_Dn) {
         $parentDn = $parentDn->toString();
     }
     $children = array();
     $search = @ldap_list($this->getResource(), $parentDn, '(objectClass=*)', array('dn'));
     for ($entry = @ldap_first_entry($this->getResource(), $search); $entry !== false; $entry = @ldap_next_entry($this->getResource(), $entry)) {
         $childDn = @ldap_get_dn($this->getResource(), $entry);
         if ($childDn === false) {
             /**
              * @see Zend_Ldap_Exception
              */
             #require_once 'Zend/Ldap/Exception.php';
             throw new Zend_Ldap_Exception($this, 'getting dn');
         }
         $children[] = $childDn;
     }
     @ldap_free_result($search);
     return $children;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:30,代码来源:Ldap.php


示例19: _fetch

 function _fetch()
 {
     if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0) {
         return false;
     }
     if ($this->_currentRow == 0) {
         $this->_entryID = ldap_first_entry($this->connection->_connectionID, $this->_queryID);
     } else {
         $this->_entryID = ldap_next_entry($this->connection->_connectionID, $this->_entryID);
     }
     $this->fields = ldap_get_attributes($this->connection->_connectionID, $this->_entryID);
     $this->_numOfFields = $this->fields['count'];
     switch ($this->fetchMode) {
         case LDAP_ASSOC:
             $this->fields = $this->GetRowAssoc();
             break;
         case LDAP_NUM:
             $this->fields = $this->GetRowNums();
             break;
         case LDAP_BOTH:
         default:
             break;
     }
     return is_array($this->fields);
 }
开发者ID:johnfelipe,项目名称:orfeo,代码行数:25,代码来源:adodb-ldap.inc.php


示例20: SortPaginate

 /**
  * @param string $sSortField
  * @param string $bAsc 'asc' or 'desc'
  * @param int $iOffset = null
  * @param int $iRequestLimit = null
  * @return array
  */
 public function SortPaginate($sSortField, $bAsc = true, $iOffset = null, $iRequestLimit = null)
 {
     $iTotalEntries = @ldap_count_entries($this->rLink, $this->rSearch);
     $iEnd = 0;
     $iStart = 0;
     if ($iOffset === null || $iRequestLimit === null) {
         $iStart = 0;
         $iEnd = $iTotalEntries - 1;
     } else {
         $iStart = $iOffset;
         $iStart = $iStart < 0 ? 0 : $iStart;
         $iEnd = $iStart + $iRequestLimit;
         $iEnd = $iEnd > $iTotalEntries ? $iTotalEntries : $iEnd;
     }
     if (0 < strlen($sSortField)) {
         @ldap_sort($this->rLink, $this->rSearch, $sSortField);
     }
     $aList = array();
     for ($iCurrent = 0, $rEntry = ldap_first_entry($this->rLink, $this->rSearch); $iCurrent < $iEnd && is_resource($rEntry); $iCurrent++, $rEntry = ldap_next_entry($this->rLink, $rEntry)) {
         if ($iCurrent >= $iStart) {
             array_push($aList, ldap_get_attributes($this->rLink, $rEntry));
         }
     }
     return $bAsc ? $aList : array_reverse($aList);
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:32,代码来源:ldap.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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