| Current Path : /var/www/html/mmishra/indem/scripts/php/ |
| Current File : /var/www/html/mmishra/indem/scripts/php/mailinglist_subscribeall.php |
<?php
$ds = ldap_connect("ldap.iiita.ac.in");
$ou = "ou=phd,ou=student,dc=iiita,dc=ac,dc=in";
if ($ds){
// bind with appropriate dn to give update access
//$r = ldap_bind($ds,"cn=Manager,dc=iiita,dc=ac,dc=in","\$dollfinn");
$sr = ldap_search($ds, "$ou", "mail=*");
$info = ldap_get_entries($ds, $sr);
//$arr["businessCategory"][0] = "everyone";
//$arr["businessCategory"][1] = "student";
//$arr["businessCategory"][2] = "btechec2008";
foreach ($info as $acc){
$i++;
$uid = $acc["uid"][0];
$email = $acc["mail"][0];
//$dn = "uid=$uid,$ou";
//ldap_modify($ds,$dn,$arr);
echo "$i. $email subscribed for ...\n";
foreach ($acc["businesscategory"] as $b){
if (strlen($b) > 1){
//========register in businesscategory list
$cmd = "/usr/local/bin/ezmlm/ezmlm-sub /mail/lists/$b/list $email 2>&1";
$output = shell_exec($cmd);
echo "-- $b@lists.iiita.ac.in\n";
}
}
}
}
exit;
$ou = "ou=rgiit,dc=iiita,dc=ac,dc=in";
if ($ds){
// bind with appropriate dn to give update access
$r = ldap_bind($ds);
$sr = ldap_search($ds, "$ou", "mail=*");
$info = ldap_get_entries($ds, $sr);
foreach ($info as $acc){
$i++;
$email = $acc["mail"][0];
echo $i . ". " . $email . " subscribed for ...\n";
foreach ($acc["businesscategory"] as $b){
if (strlen($b) > 1){
//========register in businesscategory list
$cmd = "/usr/local/bin/ezmlm/ezmlm-sub /mail/lists/$b/list $email 2>&1";
$output = shell_exec($cmd);
echo "--" . $b . "@lists.iiita.ac.in\n";
}
}
}
}
$ou = "ou=employee,dc=iiita,dc=ac,dc=in";
if ($ds){
// bind with appropriate dn to give update access
$r = ldap_bind($ds);
$sr = ldap_search($ds, "$ou", "mail=*");
$info = ldap_get_entries($ds, $sr);
foreach ($info as $acc){
$i++;
$email = $acc["mail"][0];
echo $i . ". " . $email . " subscribed for ...\n";
foreach ($acc["businesscategory"] as $b){
if (strlen($b) > 1){
//========register in businesscategory list
$cmd = "/usr/local/bin/ezmlm/ezmlm-sub /mail/lists/$b/list $email 2>&1";
$output = shell_exec($cmd);
echo "--" . $b . "@lists.iiita.ac.in\n";
}
}
}
}
$cmd = "/usr/local/bin/ezmlm/ezmlm-sub /mail/lists/everyone/list contact@iiita.ac.in 2>&1";
$output = shell_exec($cmd);
ldap_close($ds);
?>