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.php
<?php

$ds = ldap_connect("ldap.iiita.ac.in");
//fwrite(STDOUT, "Please enter mailing list name\n"); 
// Read the input 
echo "Enter List Name: ";
$listname = fgets(STDIN);
$listname = str_replace("\n","",$listname);//to remove \n character

echo "Proceed with Creation? [y/n]: ";
$confirm = fgets(STDIN);
$confirm = str_replace("\n","",$confirm);//to remove \n character

if ($confirm == "y"){
  echo $listname . " List deletion in progress...\n";
  $command = "rm -r /mail/lists/$listname";
  $output = shell_exec($command);
  echo "Mailstore removed... $command >> $output\n";

}else{
  exit("Aborted.");
}

//create ldap account
$ou = "ou=mailinglists,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", "aksr2it");
    $dn = "uid=$listname,$ou";
    $r = ldap_delete($ds, $dn);
 
    if ($r) echo $dn . " -- " . $listname . "@lists.iiita.ac.in successfully deleted.\n";
    else echo $dn . " -- " . $listname . "@lists.iiita.ac.in could not be deleted.\n";
}
ldap_close($ds);


?>
                               

ZeroDay Forums Mini