As the title says, when I try to use ldap_sort() method it returns deprecated method
Why ? Is there any equivalent ?
Also is it to possible to sort A-Z in the filter ?
As the title says, when I try to use ldap_sort() method it returns deprecated method
Why ? Is there any equivalent ?
Also is it to possible to sort A-Z in the filter ?
$sr=ldap_search($test_ldap, $base, $filter, $attrs, 0, -1, -1, LDAP_DEREF_NEVER, [['oid' => LDAP_CONTROL_SORTREQUEST, 'value' => [['attr'=>'samaccountname']]]]);
will perform server side sorting
when combining this with paged search results, it looks like this:
$cookie = '';
do {
$request_controls=[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2, 'cookie' => $cookie]], ['oid' => LDAP_CONTROL_SORTREQUEST, 'value' => [['attr'=>'samaccountname']]]];
$sr = ldap_search($ldap, $base, $filter, $attribs, 0, 0, 0, LDAP_DEREF_NEVER, $request_controls );
ldap_parse_result($ldap, $sr, $errcode , $matcheddn , $errmsg , $referrals, $response_controls);
$results = ldap_get_entries($ldap, $sr);
for ($i=0; $i<$results["count"]; $i++) {
echo($results[$i]['samaccountname'][0]); echo('<br>');
}
if (isset($response_controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {$cookie = $response_controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']; } else { $cookie = ''; }
} while (!empty($cookie));