jb-data.de/scripts/webspace.php
2025-08-11 22:23:30 +02:00

425 lines
16 KiB
PHP

<?php
require 'lib/soap_config.php';
$GLOBALS['template']->assign('aktiv', 'home');
$sel_web_doamin=$GLOBALS['mysql_isp']->query_single("SELECT * FROM web_domain WHERE domain_id='".$_GET['id']."' AND sys_userid = '".$userdata['ispcID']."'");
if($sel_web_doamin['num_rows'] != 0) {
if(isset($_POST['delete_ftp_account'])) { // FTP ACCOUNT LÖSCHEN
$checkFTP=$GLOBALS['mysql_isp']->query_single("SELECT * FROM ftp_user WHERE ftp_user_id='".$_POST['ftpID']."' AND sys_userid = '".$userdata['ispcID']."'");
if($checkFTP['num_rows'] == 1) {
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
$ftp_user_id = $_POST['ftpID'];
$affected_rows = $client->sites_ftp_user_delete($session_id, $ftp_user_id);
if($client->logout($session_id)) { }
}
} catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$success = 'FTP Account wurde erfolgreich gelöscht.';
$GLOBALS['template']->assign('success', $success);
$GLOBALS['template']->assign('aktiv', 'ftp');
}
}
if(isset($_POST['del_email_fw'])) { // email weiterleitung LÖSCHEN
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
$affected_rows = $client->mail_forward_delete($session_id, $_POST['fw_id']);
if($client->logout($session_id)) { }
}
} catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$success = 'Email Weiterleitung wurde erfolgreich gelöscht.';
$GLOBALS['template']->assign('success', $success);
$GLOBALS['template']->assign('aktiv', 'email');
}
if(isset($_POST['create_ftp_account'])) { // KUNDE ERSTELLT FTP ACCOUNT
if(isset($_POST['ftp_user_name']) && $_POST['ftp_user_name'] != '') {
if(strlen($_POST['ftp_user_password']) > 5) {
$checkFTP=$GLOBALS['mysql_isp']->query_single("SELECT * FROM ftp_user WHERE sys_userid = '".$userdata['ispcID']."' AND username = '".$sel_web_doamin['domain'].'_'.$_POST['ftp_user_name']."'");
if($checkFTP['num_rows'] == 0) {
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
}
//* Set the function parameters.
$client_id = 1;
$params = array(
'server_id' => $sel_web_doamin['server_id'],
'parent_domain_id' => $sel_web_doamin['domain_id'],
'username' => $sel_web_doamin['domain'].'_'.$_POST['ftp_user_name'],
'password' => $_POST['ftp_user_password'],
'quota_size' => 10000,
'active' => 'y',
'uid' => $sel_web_doamin['system_user'],
'gid' => $sel_web_doamin['system_group'],
'dir' => $sel_web_doamin['document_root'],
'quota_files' => -1,
'ul_ratio' => -1,
'dl_ratio' => -1,
'ul_bandwidth' => -1,
'dl_bandwidth' => -1
);
$affected_rows = $client->sites_ftp_user_add($session_id, $client_id, $params);
$GLOBALS['mysql_isp']->insert("UPDATE ftp_user SET sys_userid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE ftp_user_id='".$affected_rows."'"); // FTP AUF USER SCHREIBEN
if($client->logout($session_id)) { }
} catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$success = 'FTP Account wurde erfolgreich erstellt.';
$GLOBALS['template']->assign('success', $success);
$GLOBALS['template']->assign('aktiv', 'ftp');
}
}
}
} // ENDE POST CREATE FTP
if(isset($_POST['create_email_account'])) { // KUNDE ERSTELLT E-Mail ACCOUNT
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
}
$mailexplode = explode('@',$_POST['email_adresse']);
//* Set the function parameters.
$client_id = $userdata['ispcID'];
$params = array(
'server_id' => $sel_web_doamin['server_id'],
'email' => $_POST['email_adresse'],
'login' => $_POST['email_adresse'],
'password' => $_POST['email_password'],
'name' => $_POST['email_name'],
'uid' => 5000,
'gid' => 5000,
'maildir' => '/var/vmail/'.$mailexplode[1].'/'.$mailexplode[0],
'quota' => 5242880,
'cc' => '',
'homedir' => '/var/vmail',
'autoresponder' => 'n',
'autoresponder_start_date' => array('day' => 1, 'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
'autoresponder_end_date' => array('day' => 20, 'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
'autoresponder_text' => 'hallo',
'move_junk' => 'n',
'custom_mailfilter' => 'spam',
'postfix' => 'n',
'access' => 'n',
'disableimap' => 'n',
'disablepop3' => 'n',
'disabledeliver' => 'n',
'disablesmtp' => 'n'
);
$affected_rows = $client->mail_user_add($session_id, $client_id, $params);
$GLOBALS['mysql_isp']->insert("UPDATE mail_user SET sys_userid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE mailuser_id='".$affected_rows."'"); // mail AUF USER SCHREIBEN
if($client->logout($session_id)) {
}
} catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['edit_email_accounts'])) { // KUNDE bearbeitet E-Mail account Name
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
}
//* Set the function parameters.
$client_id = $userdata['ispcID'];
echo "===============================================".$client_id;
$mail_user_record = $client->mail_user_get($session_id, $_POST['ac_id']);
$mail_user_record['name'] = $_POST['email_name'];
$affected_rows = $client->mail_user_update($session_id, $client_id-1,$_POST['ac_id'], $mail_user_record);
// $GLOBALS['mysql_isp']->insert("UPDATE mail_forwarding SET sys_groupid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE forwarding_id='".$affected_rows."'"); // mail AUF USER SCHREIBEN
if($client->logout($session_id)) {
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['edit_email_accounts_pw'])) { // KUNDE bearbeitet E-Mail account Passwort
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
}
//* Set the function parameters.
$client_id = $userdata['ispcID'];
echo "===============================================".$client_id;
$mail_user_record = $client->mail_user_get($session_id, $_POST['ac_id']);
$mail_user_record['password'] = $_POST['email_pw'];
$affected_rows = $client->mail_user_update($session_id, $client_id-1,$_POST['ac_id'], $mail_user_record);
// $GLOBALS['mysql_isp']->insert("UPDATE mail_forwarding SET sys_groupid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE forwarding_id='".$affected_rows."'"); // mail AUF USER SCHREIBEN
if($client->logout($session_id)) {
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['create_email_catchall'])) { // KUNDE ERSTELLT E-Mail catchall
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
}
//* Set the function parameters.
$client_id = $userdata['ispcID'];
$params = array(
'server_id' => $sel_web_doamin['server_id'],
'source' => '@'.$sel_web_doamin['domain'],
'destination' => $_POST['email_adresse'],
'type' => 'catchall',
'active' => 'y'
);
$affected_rows = $client->mail_catchall_add($session_id, $client_id, $params);
echo "Catchall ID: ".$affected_rows."<br>";
$GLOBALS['mysql_isp']->insert("UPDATE mail_forwarding SET sys_groupid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE forwarding_id='".$affected_rows."'"); // mail AUF USER SCHREIBEN
if($client->logout($session_id)) {
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['edit_email_catchall'])) { // KUNDE bearbeitet Catchall e-mail
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
$client_id = $userdata['ispcID'];
$affected_rows = $client->mail_catchall_delete($session_id,$_POST['c_id']);
$params = array(
'server_id' => $sel_web_doamin['server_id'],
'source' => '@'.$sel_web_doamin['domain'],
'destination' => $_POST['email_adresse'],
'type' => 'catchall',
'active' => 'y'
);
$affected_rows = $client->mail_catchall_add($session_id, $client_id, $params);
$GLOBALS['mysql_isp']->insert("UPDATE mail_forwarding SET sys_groupid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE forwarding_id='".$affected_rows."'"); // mail AUF USER SCHREIBEN
if($client->logout($session_id)) {
}
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['del_email_catchall'])) { // KUNDE löscht Catchall e-mail
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
$client_id = $userdata['ispcID'];
$affected_rows = $client->mail_catchall_delete($session_id,$_POST['c_id']);
if($client->logout($session_id)) {
}
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['create_email_forward'])) { // KUNDE ERSTELLT E-Mail forward
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
}
//* Set the function parameters.
$client_id = $userdata['ispcID'];
$params = array(
'server_id' => $sel_web_doamin['server_id'],
'source' => $_POST['email_name'].'@'.$sel_web_doamin['domain'],
'destination' => $_POST['email_adresse'],
'type' => 'forward',
'active' => 'y'
);
$affected_rows = $client->mail_forward_add($session_id, $client_id, $params);
$GLOBALS['mysql_isp']->insert("UPDATE mail_forwarding SET sys_groupid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE forwarding_id='".$affected_rows."'"); // mail AUF USER SCHREIBEN
if($client->logout($session_id)) {
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['edit_email_forward'])) { // KUNDE bearbeitet forward e-mail
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
$client_id = $userdata['ispcID'];
$affected_rows = $client->mail_forward_delete($session_id,$_POST['fw_id']);
$params = array(
'server_id' => $sel_web_doamin['server_id'],
'source' => $_POST['email_s'],
'destination' => $_POST['email_d'],
'type' => 'forward',
'active' => 'y'
);
$affected_rows = $client->mail_forward_add($session_id, $client_id, $params);
$GLOBALS['mysql_isp']->insert("UPDATE mail_forwarding SET sys_groupid='".$userdata['ispcID']."',sys_groupid='".$userdata['ispcID']."' WHERE forwarding_id='".$_POST['fw_id']."'"); // mail AUF USER SCHREIBEN
if($client->logout($session_id)) {
}
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
if(isset($_POST['del_email_forward'])) { // KUNDE löscht forward e-mail
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
try {
if($session_id = $client->login($username, $password)) {
$client_id = $userdata['ispcID'];
$affected_rows = $client->mail_forward_delete($session_id,$_POST['fw_id']);
if($client->logout($session_id)) {
}
}
}
catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
$GLOBALS['template']->assign('aktiv', 'email');
}
//----------------------------------------------------------------------------------------------
$ftp_doaminCHECK=$GLOBALS['mysql_isp']->query_single("SELECT * FROM ftp_user WHERE parent_domain_id='".$_GET['id']."' AND sys_userid = '".$userdata['ispcID']."'");
if($ftp_doaminCHECK['num_rows'] > 0) {
$ftp_doamin=$GLOBALS['mysql_isp']->query_array("SELECT * FROM ftp_user WHERE parent_domain_id='".$_GET['id']."' AND sys_userid = '".$userdata['ispcID']."'");
$GLOBALS['template']->assign('ftp_doamin', $ftp_doamin);
}
$mail_accountsCHECK=$GLOBALS['mysql_isp']->query_single("SELECT * FROM mail_user WHERE email LIKE '%@".$sel_web_doamin['domain']."' AND sys_userid = '".$userdata['ispcID']."'");
if($mail_accountsCHECK['num_rows'] > 0) {
$mail_accounts=$GLOBALS['mysql_isp']->query_array("SELECT * FROM mail_user WHERE email LIKE '%@".$sel_web_doamin['domain']."' AND sys_userid = '".$userdata['ispcID']."'");
$mail_forwarding=$GLOBALS['mysql_isp']->query_array("SELECT * FROM mail_forwarding WHERE source LIKE '%@".$sel_web_doamin['domain']."' and type!='catchall'");
$mail_catchall=$GLOBALS['mysql_isp']->query_single("SELECT * FROM mail_forwarding WHERE source LIKE '%@".$sel_web_doamin['domain']."' and type='catchall'");
if($mail_catchall['num_rows'] == 0) { $no_ca=1; $GLOBALS['template']->assign('no_ca', $no_ca); } // gibt es einen catchall oder nicht
$GLOBALS['template']->assign('mail_accounts', $mail_accounts);
$GLOBALS['template']->assign('mail_accounts2', $mail_accounts);
$GLOBALS['template']->assign('mail_accounts3', $mail_accounts);
$GLOBALS['template']->assign('mail_forwarding', $mail_forwarding);
$GLOBALS['template']->assign('mail_forwarding2', $mail_forwarding);
$GLOBALS['template']->assign('mail_catchall', $mail_catchall);
}
$GLOBALS['template']->assign('sel_web_doamin', $sel_web_doamin);
$template->assign('content', 'tpl/webspace.tpl');
} else {
$template->assign('content', 'tpl/404.tpl');
}
?>