Server : Apache System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 User : apache ( 48) PHP Version : 8.0.28 Disable Function : NONE Directory : /var/www/html/mmishra/erp19-7-2019/ |
<?php
$ds = ldap_connect("ldap://172.31.1.41:389");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$data = ldap_search($ds, "dc=iiita,dc=ac,dc=in", "ou=employee*");
$rows = ldap_get_entries($ds, $data);
arsort($rows);
foreach ($rows as $row) {
$dn = strtolower($row['dn']);
//echo $dn;
if (strpos($dn, 'employee') || strpos($dn, 'student')) {
$data = ldap_search($ds, $dn, "uid=*");
$info = ldap_get_entries($ds, $data);
//print('<pre>');
//print_r($info);
//print('</pre>');
arsort($info);
for ($i=0; $i<$info["count"]; $i++) {
$uid = $info[$i]['uid'][0];
echo $uid."\n";
}
}
}
?>