The LDAP sorting code I posted a couple of days ago was a bit lacking.
Here's a function that should work:
function myldap_sort($data, $attr) {
// -1 because of the count entry
echo "#", $n = count($data) - 1;
for ($i=0; $i<$n; $i++) {
$a[$i]=$data[$i][$attr][0];
}
asort($a);
reset($a);
for ($j=0; list($i,) = each($a); $j++) {
$sorted[$j] = $data[$i];
}
return $sorted;
}
It's not fast, but should work. Example usage:
$info = ldap_get_entries($ds, $sr);
$sorted = myldap_sort($info, "cn");
It assumes that the attribute specified is present in all the entries,
and only uses the first value of the attribute.
Stig
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]