Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/scripts/php/
Upload File :
Current File : /var/www/html/mmishra/indem/scripts/php/tunelists.php

<?php
$ds = ldap_connect("ldap.iiita.ac.in");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);

//echo "Proceed? [y/n]: ";
//$yn = fgets(STDIN);
//$yn = str_replace("\n","",$yn);

//if ($yn == 'n') exit("Aborted.");
$ou = "ou=employee,dc=iiita,dc=ac,dc=in";
$no = 0;
if ($ds){
        $sr = ldap_search($ds, "$ou", "(&(uid=*)(objectClass=posixAccount))");
        $info = ldap_get_entries($ds, $sr);
        for ($i=0; $i < $info["count"]; $i++) {
                $uid = $info[$i]["uid"][0];
                $dn = $info[$i]["dn"];
                $email = $info[$i]["mail"][0];
                $bcs = $info[$i]["businesscategory"];
                $homedir = $info[$i]["homedirectory"][0];
		echo $uid . " - ";
                if ($uid) {
                	foreach ($bcs as $bc) {
		        	$mm = shell_exec("/opt/arithme/bin/nspamlistadmin in $bc@lists.iiita.ac.in show | grep $uid");
				if ($mm) echo $bc . ' ';
				$mm = '';
			}
                        $no++;
                }
		echo "\n";
        }
}
if ($no) echo "Total: $no";
ldap_close($ds);


?>