/var/vmail/(domain)/(user) directories and files not delete when mail_user is deleted via remote.
/var/vmail/(domain)/(user) directories and files not delete when mail_user is deleted via remote call using the following code...
[code] // Configuration values $username = 'admin'; $password = 'xxx'; $server_ip = 'xxx'; $server_port = 'xxx'; $db_user='root'; $db_password='xxx'; $db_host='localhost'; $db_name='dbispconfig'; $db_table='mail_user';
function get_mailuser_id($db_host, $db_user, db_password,
db_name,db_table,
soap_email) {
conn = mysql_connect(
db_host, $db_user, $db_password) or die('Error connecting to mysql');
db_found=mysql_select_db(
db_name);
if ($db_found) {
$SQL = "SELECT mailuser_id FROM db_table WHERE email='
soap_email'";
dbread = mysql_fetch_row(mysql_query(
SQL));
$mailuser_id = $dbread[0];
} else {
$soap_result .= 'Database Not Found ';
}
mysql_close($conn);
return $mailuser_id;
}
if (isset($_REQUEST['SOAP_FUNCTION'])) {
$soap_location = 'http://'.$server_ip.':'.$server_port.'/remote/index.php';
$soap_uri = 'http://'.$server_ip.':'.$server_port.'/remote/';
$soap_result = 'Results: ';
$soap_function = $_REQUEST['SOAP_FUNCTION'];
$soap_user = $_REQUEST['SOAP_USER'];
$soap_domain = $_REQUEST['SOAP_DOMAIN'];
$soap_email = $soap_user.'@'.$soap_domain;
$soap_password = $_REQUEST['SOAP_PASSWORD'];
$soap_quota = $_REQUEST['SOAP_QUOTA'];
$soap_maildir = '/var/vmail/'.$soap_domain.'/'.$soap_user;
$client = new SoapClient(null, array('location' => $soap_location,'uri' => $soap_uri,'trace'=>1));
//echo htmlentities($client->__getFunctions());
try {
if($session_id = $client->login($username,$password)) {
$soap_result .= 'Logged In... Session: '.$session_id.'... '; // Zalogowany. Sesja:
}
switch ($soap_function){
case 'Add':
... break;
case 'Update':
... break;
case 'Delete':
$client_id = 0;
$mailuser_id = get_mailuser_id($db_host, $db_user, $db_password,$db_name,$db_table,$soap_email);
$domain__id = $client->mail_user_delete($session_id,$mailuser_id);
$soap_user = '';
$soap_domain = '';
$soap_password = '';
$soap_quota = '';
break;
}
if($client->logout($session_id)) {
$soap_result .= 'Logged Out!<br /><br />'; // Wylogowany
}
} catch (SoapFault $soapFault) {
echo "Request :<br><pre>", htmlentities($client->__getLastRequest()), "</pre><br>";
echo "Response :<br><pre>", htmlentities($client->__getLastResponse()), "</pre><br>";
die('SOAP Error: '.$e->getMessage()); // SOAP Blad
}
print $soap_result;
} else {
print 'Please select function (Add, Update or Delete).
';
}
$output = '
|
Add Update Delete |