if ($noOfFieldsSet >= 2) { $searchFilter = “(&”

if ($noOfFieldsSet >= 2) { $searchFilter = “(&” .$searchFilter. “)”; } return $searchFilter; } This function; given a link identifier obtained from the connectBindServer()function and the search filter created by createSearchFilter(), performs a search on the directory: function searchDirectory($linkIdentifier, $searchFilter) { global $baseDN; $searchResult = ldap_search($linkIdentifier, $baseDN, $searchFilter); We count the search results to see if we got any entries at all: if (ldap_count_entries($linkIdentifier, $searchResult) <= 0) { displayErrMsg("No entries returned from the directory"); return 0; } else { $resultEntries = ldap_get_entries($linkIdentifier, $searchResult); return $resultEntries; } } This function prints the result of a search as an HTML table: function printResults($resultEntries) { printf("

n”); printf(”

n”); $noOfEntries = $resultEntries[”count”]; for ($i = 0; $i < $noOfEntries; $i++) { if (!$resultEntries[$i]["cn"] && !$resultEntries[$i]["sn"]) continue; $mailString = urlencode($resultEntries[$i]["mail"][0]); $ouString = urlencode($resultEntries[$i]["ou"][0]); Page 515
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra j2ee hosting services

Comments are closed.


First Name Last Name E-mail Employee # Department Telephone Edit