Sh3ll
OdayForums


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/indem/scripts/php/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/mmishra/indem/scripts/php/mailinglist_remove_account.php
<?php
/*
echo "Remove Subscribers from Mailing List\n";
echo "===============================\n\n";
echo "Category (student, employee, rgiit): ";
$cat = trim(fgets(STDIN)); // reads one line from STDIN
if ($cat == "") $cat = "student";

if ($cat == "employee"){
	echo "Subcategory (faculty, officer, techstaff, adminstaff, projectstaff): ";
  	$subcat = trim(fgets(STDIN)); // reads one line from STDIN
  	$ou = "ou=$subcat";
}else{
  	echo "Course: ";
  	$course = trim(fgets(STDIN)); // reads one line from STDIN
  	echo "Specialization: ";
  	$spec = trim(fgets(STDIN)); // reads one line from STDIN
  	echo "Batch: ";
  	$batch = trim(fgets(STDIN)); // reads one line from STDIN
  	$ou = "ou=$batch,ou=$spec,ou=$course";
}
$ou .= ",ou=$cat,dc=iiita,dc=ac,dc=in";

echo "Mailing List ID: ";
$mlist = trim(fgets(STDIN)); // reads one line from STDIN
if (!$mlist && !$cat == "employee") $mlist = "$course$spec$batch";
//fscanf(STDIN, "%d\n", $number); // reads number from STDIN
*/
$mlist = "student";
$ds = ldap_connect("ldap.iiita.ac.in");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$sr = ldap_search($ds, "ou=2006,ou=it,ou=btech,ou=alumni,dc=iiita,dc=ac,dc=in", "uid=*");
$info = ldap_get_entries($ds, $sr);
$count = count($info);
sort($info);
$j = 0;
for($i=0; $i < $count-1; $i++){
  	$val = $info[$i]['uid'][0];
  	if ($val){
    		$j++;
    		$email = $val . "@iiita.ac.in";
    		$cmd = "/usr/local/bin/ezmlm/ezmlm-unsub /mail/lists/$mlist/list $email 2>&1";
    		$output = shell_exec($cmd);
    		echo $j . ". " . $email . " removed\n";
  	}
}

echo "\n\nRemaining subscribers...\n\n";
$cmd = "/usr/local/bin/ezmlm/ezmlm-list /mail/lists/$mlist/list 2>&1";
$output = shell_exec($cmd);
echo $output;

$cmd = "/usr/local/bin/ezmlm/ezmlm-list /mail/lists/$mlist/list 2>&1 | wc";
$output = shell_exec($cmd);
echo $output;
?>

ZeroDay Forums Mini