Removed localization
Migrated to mysqli
This commit is contained in:
parent
f37e6539ed
commit
e9ddc55b6f
1 changed files with 159 additions and 222 deletions
381
mail_control.php
381
mail_control.php
|
@ -16,35 +16,33 @@
|
||||||
/* Var-Setup */
|
/* Var-Setup */
|
||||||
define('db_server','localhost');
|
define('db_server','localhost');
|
||||||
define('db_name','mail');
|
define('db_name','mail');
|
||||||
define('db_user','{USER}');
|
define('db_user','mail');
|
||||||
define('db_pwd','{PASSWORD}');
|
define('db_pwd','GwH_s8gJW:FvKV8RywoENMOAUJbGQyF:');
|
||||||
$tbl_aliases = 'virtual_aliases';
|
|
||||||
$tbl_domains = 'virtual_domains';
|
|
||||||
$tbl_users = 'virtual_users';
|
|
||||||
$lang = 'de';
|
$lang = 'de';
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
function query($sql) {
|
function query($sql) {
|
||||||
global $cid;
|
global $cid, $mysql_result;
|
||||||
if($sql) return mysql_query($sql,$cid);
|
echo $sql;
|
||||||
|
if($sql) return $mysql_result = $cid->query($sql);
|
||||||
//else die(mysql_error());
|
//else die(mysql_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetch($res) {
|
function fetch($res) {
|
||||||
if($res) return mysql_fetch_array($res);
|
global $mysql_result;
|
||||||
|
if($res) return $res->fetch_all(MYSQLI_BOTH);
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connect() {
|
function connect() {
|
||||||
global $cid,$db;
|
global $cid,$db;
|
||||||
$cid = mysql_connect(db_server,db_user,db_pwd);
|
$cid = new mysqli(db_server, db_user, db_pwd, db_name);
|
||||||
if($cid) $db = mysql_select_db(db_name,$cid);
|
if ($cid->connect_errno) die("Verbindung fehlgeschlagen: " . $mysqli->connect_error);
|
||||||
else die(mysql_error());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function disconnect() {
|
function disconnect() {
|
||||||
global $cid;
|
global $cid;
|
||||||
if(!(mysql_close($cid))) die("Fehler beim Trennen der Verbindung!");
|
if(!($cid->close())) die("Fehler beim Trennen der Verbindung!");
|
||||||
}
|
}
|
||||||
|
|
||||||
function pw_encode($password, $rounds=10000) {
|
function pw_encode($password, $rounds=10000) {
|
||||||
|
@ -52,157 +50,93 @@ function pw_encode($password, $rounds=10000) {
|
||||||
return crypt ($password, '$5$rounds=' . $rounds . '$' . $salt);
|
return crypt ($password, '$5$rounds=' . $rounds . '$' . $salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LocalLanguage */
|
|
||||||
if ($lang) {
|
|
||||||
$LLA = array();
|
|
||||||
if ($lang == 'de') {
|
|
||||||
$LLA['de']['hide password'] = 'verstecke Passwort';
|
|
||||||
$LLA['de']['show password'] = 'zeige Passwort';
|
|
||||||
$LLA['de']['All'] = 'Alle';
|
|
||||||
$LLA['de']['Alias Management'] = 'Alias-Verwaltung';
|
|
||||||
$LLA['de']['New Alias'] = 'Alias hinzufügen';
|
|
||||||
$LLA['de']['Action'] = 'Aktion';
|
|
||||||
$LLA['de']['Source'] = 'Quelle';
|
|
||||||
$LLA['de']['Destination'] = 'Ziel';
|
|
||||||
$LLA['de']['Enabled'] = 'Aktiviert';
|
|
||||||
$LLA['de']['Domain Management'] = 'Domain-Verwaltung';
|
|
||||||
$LLA['de']['User Management'] = 'User-Verwaltung';
|
|
||||||
$LLA['de']['New Domain'] = 'Domain hinzufügen';
|
|
||||||
$LLA['de']['Change this record'] = 'Diesen Eintrag ändern';
|
|
||||||
$LLA['de']['Delete this record'] = 'Diesen Eintrag löschen';
|
|
||||||
$LLA['de']['Reset'] = 'Zurücksetzen';
|
|
||||||
$LLA['de']['New User'] = 'User hinzufügen';
|
|
||||||
$LLA['de']['Username'] = 'Benutzername';
|
|
||||||
$LLA['de']['Password'] = 'Passwort';
|
|
||||||
$LLA['de']['ERROR adding Alias'] = 'Fehler beim Hinzufügen eines Aliases';
|
|
||||||
$LLA['de']['ERROR adding Domain'] = 'Fehler beim Hinzufügen einer Domain';
|
|
||||||
$LLA['de']['ERROR adding User'] = 'Fehler beim Hinzufügen eines Users';
|
|
||||||
$LLA['de']['Back'] = 'Zurück';
|
|
||||||
$LLA['de']['was added...'] = ' wurde hinzugefügt...';
|
|
||||||
$LLA['de']['Delete this alias?'] = 'Diesen Alias wirklich löschen?';
|
|
||||||
$LLA['de']['Delete this domain?'] = 'Diese Domain wirklich löschen?';
|
|
||||||
$LLA['de']['Delete this user?'] = 'Diesen User wirklich löschen?';
|
|
||||||
$LLA['de']['was deleted...'] = 'wurde gelöscht';
|
|
||||||
$LLA['de']['was changed...'] = 'wurde geändert...';
|
|
||||||
$LLA['de']['No'] = 'Nein';
|
|
||||||
$LLA['de']['Yes'] = 'Ja';
|
|
||||||
$LLA['de']['Edit Alias'] = 'Alias bearbeiten';
|
|
||||||
$LLA['de']['Edit Domain'] = 'Domain bearbeiten';
|
|
||||||
$LLA['de']['Edit User'] = 'User bearbeiten';
|
|
||||||
$LLA['de']['Target'] = 'Ziel';
|
|
||||||
$LLA['de']['Cancel'] = 'Abbrechen';
|
|
||||||
$LLA['de']['Speichern'] = 'Save';
|
|
||||||
$LLA['de']['Reset'] = 'Zurüksetzen';
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
also available:
|
|
||||||
- Aliases
|
|
||||||
- Domains
|
|
||||||
- User
|
|
||||||
- ID
|
|
||||||
- Domain
|
|
||||||
- Name
|
|
||||||
- Ok
|
|
||||||
leave one alias out in the language conf and the original one will be used.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
function echoAl($al) {
|
|
||||||
global $LLA, $lang;
|
|
||||||
if (!$LLA[$lang]) {echo 'aaaa'; return false;}
|
|
||||||
if (!$LLA[$lang]) {echo $al; return false;}
|
|
||||||
if (!$LLA[$lang][$al]) {echo $al; return false;}
|
|
||||||
echo $LLA[$lang][$al];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function retAl($al) {
|
|
||||||
global $LLA, $lang;
|
|
||||||
if (!$LLA[$lang]) return 'bbbb';
|
|
||||||
if (!$LLA[$lang]) return $al;
|
|
||||||
if (!$LLA[$lang][$al]) return $al;
|
|
||||||
return $LLA[$lang][$al];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
connect();
|
connect();
|
||||||
$do = $_REQUEST['do'];
|
$do = array_key_exists('do', $_REQUEST) ? $_REQUEST['do'] : false;
|
||||||
$id = $_REQUEST['id'];
|
$id = array_key_exists('id', $_REQUEST) ? $_REQUEST['id'] : false;
|
||||||
$new = $_REQUEST['new'];
|
$new = array_key_exists('new', $_REQUEST) ? $_REQUEST['new'] : false;
|
||||||
$del = $_REQUEST['del'];
|
$del = array_key_exists('del', $_REQUEST) ? $_REQUEST['del'] : false;
|
||||||
$chg = $_REQUEST['chg'];
|
$chg = array_key_exists('chg', $_REQUEST) ? $_REQUEST['chg'] : false;
|
||||||
$ack = $_REQUEST['ack'];
|
$ack = array_key_exists('ack', $_REQUEST) ? $_REQUEST['ack'] : false;
|
||||||
$domain = $_REQUEST['domain'];
|
$domain = array_key_exists('domain' , $_REQUEST) ? $_REQUEST['domain' ] : false;
|
||||||
$source = $_REQUEST['src'];
|
$source = array_key_exists('source' , $_REQUEST) ? $_REQUEST['source' ] : false;
|
||||||
$usr = $_REQUEST['usr'];
|
$usr = array_key_exists('usr' , $_REQUEST) ? $_REQUEST['usr' ] : false;
|
||||||
$pwd = $_REQUEST['pwd'];
|
$pwd = array_key_exists('pwd' , $_REQUEST) ? $_REQUEST['pwd' ] : false;
|
||||||
$dest = $_REQUEST['dest'];
|
$dest = array_key_exists('dest' , $_REQUEST) ? $_REQUEST['dest' ] : false;
|
||||||
$enabled = $_REQUEST['enabled'];
|
$enabled = array_key_exists('enabled', $_REQUEST) ? $_REQUEST['enabled'] : false;
|
||||||
$ndomain = $_REQUEST['new_domain'];
|
$ndomain = array_key_exists('ndomain', $_REQUEST) ? $_REQUEST['ndomain'] : false;
|
||||||
$orderby = $_REQUEST['orderby'];
|
$orderby = array_key_exists('orderby', $_REQUEST) ? $_REQUEST['orderby'] : false;
|
||||||
$sel = $_GET['sel'];
|
$sel = array_key_exists('sel' , $_REQUEST) ? $_REQUEST['sel' ] : false;
|
||||||
|
|
||||||
$fetch_list = mysql_query("SELECT * FROM `" . $tbl_domains . "` ORDER BY `name` ASC");
|
$fetch_list = $cid->query("SELECT * FROM `domains` ORDER BY `domain` ASC");
|
||||||
$orderbysql = $orderby ? ' ORDER BY '.$orderby.';' : ';';
|
$orderbysql = $orderby ? ' ORDER BY '.$orderby.';' : ';';
|
||||||
$selectsql = $sel ? ' AND ' . $tbl_domains . '.id = '.$sel : '';
|
$selectsql = $sel ? ' AND domain_id = '.$sel : '';
|
||||||
## Query Aliases ##
|
## Query Aliases ##
|
||||||
$sql[1] = "SELECT " . $tbl_aliases . ".id, " . $tbl_aliases . ".source, " . $tbl_domains . ".name, " . $tbl_aliases . ".destination, " . $tbl_aliases . ".enabled FROM " . $tbl_aliases . ", " . $tbl_domains . " WHERE " . $tbl_aliases . ".domain_id = " . $tbl_domains . ".id".$selectsql.$orderbysql;
|
$sql[1] = "SELECT alias_id, source_username, source_domain, destinations, enabled FROM view_aliases";
|
||||||
|
if ($sel) $sql[1] .= " WHERE domain_id=" . ($sel+0);
|
||||||
|
$sql[1] .= $orderbysql;
|
||||||
|
|
||||||
## Query Domains ##
|
## Query Domains ##
|
||||||
$sql[2] = "SELECT * FROM " . $tbl_domains . $orderbysql;
|
$sql[2] = "SELECT * FROM domains " . $orderbysql;
|
||||||
|
|
||||||
## Query Users ##
|
## Query Users ##
|
||||||
$sql[3] = "SELECT " . $tbl_users . ".id, " . $tbl_domains . ".name, " . $tbl_users . ".user FROM " . $tbl_users . ", " . $tbl_domains . " WHERE " . $tbl_users . ".domain_id = " . $tbl_domains . ".id".$selectsql.$orderbysql;
|
$sql[3] = "SELECT account_id, user, domain FROM view_accounts";
|
||||||
|
if ($sel) $sql[3] .= " WHERE domain_id=" . ($sel+0);
|
||||||
|
$sql[3] .= $orderbysql;
|
||||||
|
|
||||||
## Insert Alias Query ##
|
## Insert Alias Query ##
|
||||||
if(($domain <> "") && ($dest <> "")) $sql[4] = "INSERT INTO " . $tbl_aliases . " (domain_id, source, destination, enabled) VALUES ('$domain','$source','$dest',1);";
|
if(($domain <> "") && ($dest <> "")) $sql[4] = "INSERT INTO aliases (source_username, source_domain, destination, enabled) VALUES ('$source','$domain','$dest',1);";
|
||||||
|
|
||||||
## Insert Domain Query ##
|
## Insert Domain Query ##
|
||||||
if($ndomain <> "") {
|
if($ndomain <> "") {
|
||||||
$sql0 = "SELECT name FROM " . $tbl_domains . " WHERE name = '$ndomain';";
|
$sql0 = "SELECT domain FROM domains WHERE domain = '$ndomain';";
|
||||||
$qr = query($sql0);
|
$qr = query($sql0);
|
||||||
if(mysql_num_rows($qr) < 1) $sql[5] = "INSERT INTO " . $tbl_domains . " (name) VALUES ('$ndomain');";
|
if($qr->num_rows() < 1) $sql[5] = "INSERT INTO domains (domain) VALUES ('$ndomain');";
|
||||||
}
|
}
|
||||||
|
|
||||||
## Insert User Query ##
|
## Insert User Query ##
|
||||||
if(($domain <> "") && ($usr <> "") && ($pwd <> "")) {
|
if(($domain <> "") && ($usr <> "") && ($pwd <> "")) {
|
||||||
$sql1 = "SELECT domain_id, user, password FROM " . $tbl_users . " WHERE domain_id = $domain AND user = '$usr' AND password = '".pw_encode($pwd)."';";
|
$sql1 = "SELECT domain_id, user, password FROM accounts WHERE domain = $domain AND username = '$usr';";
|
||||||
$qr = query($sql1);
|
$qr = query($sql1);
|
||||||
if(mysql_num_rows($qr) < 1) $sql[6] = "INSERT INTO " . $tbl_users . " (domain_id, user, password) VALUES ('$domain','$usr','".pw_encode($pwd)."');
|
if($qr->num_rows() < 1) $sql[6] = "INSERT INTO accounts (domain, username, password, enabled) VALUES ('$domain','$usr','".pw_encode($pwd)."',1);";
|
||||||
";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## Delete Query ##
|
## Delete Query ##
|
||||||
if(($del <> "") && ($id <> "") && ($ack == retAl('Yes'))) {
|
if(($del <> "") && ($id <> "") && ($ack == 'Yes')) {
|
||||||
switch ($del) {
|
switch ($del) {
|
||||||
case 1: $tbl = $tbl_aliases; break;
|
case 1: $sql = "DELETE FROM aliases WHERE id = $id;"; break;
|
||||||
case 2: $tbl = $tbl_domains; break;
|
case 2: $sql = "DELETE FROM domains WHERE id = $id;"; break;
|
||||||
case 3: $tbl = $tbl_users; break;
|
case 3: $sql = "DELETE FROM accounts WHERE id = $id;"; break;
|
||||||
}
|
}
|
||||||
$sql = "DELETE FROM ".$tbl." WHERE id = $id;";
|
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
## Update Alias Query##
|
## Update Alias Query##
|
||||||
if(($chg == 1) && ($id <> "") && ($domain <> "") && ($dest <> "") && ($ack == retAl('Save'))) {
|
if(($chg == 1) && ($id <> "") && ($domain <> "") && ($dest <> "") && ($ack == 'Save')) {
|
||||||
$sql = "UPDATE ".$tbl_aliases." SET domain_id = '".$domain."', source = '".$source."', destination = '".$dest."', enabled = '".$enabled."' WHERE id = ".$id.";";
|
$sql = "UPDATE aliases SET source_domain = '".$domain."', source_username = '".$source."', destination = '".$dest."', enabled = '".$enabled."' WHERE id = ".$id.";";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
## Update Domain Query ##
|
## Update Domain Query ##
|
||||||
if(($chg == 2) && ($id <> "") && ($domain <> "") && ($ack == retAl('Save'))) {
|
if(($chg == 2) && ($id <> "") && ($domain <> "") && ($ack == 'Save')) {
|
||||||
$sql = "UPDATE ".$tbl_domains." SET name='".$domain."' WHERE id = ".$id.";";
|
$sql = "UPDATE domains SET domain='".$domain."' WHERE id = ".$id.";";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
## Update User Query ##
|
## Update User Query ##
|
||||||
if(($chg == 3) && ($id <> "") && ($domain <> "") && ($usr <> "") && ($pwd <> "") && ($ack == retAl('Save'))) {
|
if(($chg == 3) && ($id <> "") && ($domain <> "") && ($usr <> "") && ($pwd <> "") && ($ack == 'Save')) {
|
||||||
$sql = "UPDATE ".$tbl_users." SET domain_id ='".$domain."', user ='".$usr."', password = '".pw_encode($pwd)."' WHERE id = ".$id.";";
|
$sql = "UPDATE accounts SET domain ='".$domain."', username ='".$usr."', password = '".pw_encode($pwd)."' WHERE id = ".$id.";";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
}
|
}
|
||||||
if($do) $qry = query($sql[$do]);
|
if($do) { $qry = query($sql[$do]);
|
||||||
if($qry) $result = true;
|
if($qry) $result = true;
|
||||||
else $result = false;
|
else $result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Code */
|
/* Code */
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
@ -319,10 +253,10 @@ a:hover, a:focus {
|
||||||
var inp = document.getElementById("pwdInput")
|
var inp = document.getElementById("pwdInput")
|
||||||
if (inp.type == 'password') {
|
if (inp.type == 'password') {
|
||||||
inp.type = 'text';
|
inp.type = 'text';
|
||||||
beh.innerHTML = '<?php echoAl('hide password'); ?>';
|
beh.innerHTML = '<?php echo('hide password'); ?>';
|
||||||
} else {
|
} else {
|
||||||
inp.type = 'password';
|
inp.type = 'password';
|
||||||
beh.innerHTML = '<?php echoAl('show password'); ?>';
|
beh.innerHTML = '<?php echo('show password'); ?>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setDomain: function(domain) {
|
setDomain: function(domain) {
|
||||||
|
@ -338,17 +272,17 @@ a:hover, a:focus {
|
||||||
<h2>Mail-Control v1.3</h2>
|
<h2>Mail-Control v1.3</h2>
|
||||||
<form id="selection" action=""><div>
|
<form id="selection" action=""><div>
|
||||||
<select name="sel_domain" id="sel_domain" onchange="mc.changeSel(this.value)">
|
<select name="sel_domain" id="sel_domain" onchange="mc.changeSel(this.value)">
|
||||||
<option value=""><?php echoAl('All') ?></option>
|
<option value=""><?php echo('All') ?></option>
|
||||||
<?php
|
<?php
|
||||||
while ($dlist = mysql_fetch_array($fetch_list)) {
|
while ($dlist = $fetch_list->fetch_assoc()) {
|
||||||
if ($dlist['id'] == $sel) echo ' <option value="'. $dlist['id'] .'" selected="selected">'. $dlist['name'] .'</option>';
|
if ($dlist['id'] == $sel) echo ' <option value="'. $dlist['id'] .'" selected="selected">'. $dlist['domain'] .'</option>';
|
||||||
else echo ' <option value="'. $dlist['id'] .'">'. $dlist['name'].'</option>';
|
else echo ' <option value="'. $dlist['id'] .'">'. $dlist['domain'].'</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div></form>
|
</div></form>
|
||||||
<div id="topLinks">
|
<div id="topLinks">
|
||||||
<a href="<?php echo '?do=1&sel='.$sel ?>" id="aliases_link"><strong><?php echoAl('Aliases') ?></strong></a> ǀ <a href="<?php echo '?do=2&sel='.$sel ?>" id="domains_link"><strong><?php echoAl('Domains') ?></strong></a> ǀ <a href="<?php echo '?do=3&sel='.$sel ?>" id="user_link"><strong><?php echoAl('User') ?></strong></a>
|
<a href="<?php echo '?do=1&sel='.$sel ?>" id="aliases_link"><strong><?php echo('Aliases') ?></strong></a> ǀ <a href="<?php echo '?do=2&sel='.$sel ?>" id="domains_link"><strong><?php echo('Domains') ?></strong></a> ǀ <a href="<?php echo '?do=3&sel='.$sel ?>" id="user_link"><strong><?php echo('User') ?></strong></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
|
@ -356,19 +290,19 @@ a:hover, a:focus {
|
||||||
<?php
|
<?php
|
||||||
switch($new) {
|
switch($new) {
|
||||||
case 1:
|
case 1:
|
||||||
$sql = "SELECT id,name FROM " . $tbl_domains . ";";
|
$sql = "SELECT id,domain FROM domains;";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
$out = ' <div style="text-align: center;"><span id="head">'.retAl('New Alias').'</span><br /><form action="?do=4&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
$out = ' <div style="text-align: center;"><span id="head">New Alias</span><br /><form action="?do=4&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
||||||
$out.= '<table class="align-center"><tr><td class="align-right">'.retAl('Domain').':</td>';
|
$out.= '<table class="align-center"><tr><td class="align-right">Domain:</td>';
|
||||||
$out.= '<td class="align-left"><select name="domain" size="1">';
|
$out.= '<td class="align-left"><select name="domain" size="1">';
|
||||||
while($row = fetch($qry)) {
|
foreach(fetch($qry) as $row) {
|
||||||
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"';
|
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"';
|
||||||
$out.= ($row[0]==$sel) ? 'selected="selected">' :'>';
|
$out.= ($row[0]==$sel) ? 'selected="selected">' :'>';
|
||||||
$out.= $row[1].'</option>';
|
$out.= $row[1].'</option>';
|
||||||
}
|
}
|
||||||
$out.= '</select></td></tr>';
|
$out.= '</select></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Source').':</td><td class="align-left"><input type="text" id="src" name="src" size="20"></input><span id="behindSource">@'.retAl('Domain').'</span></td></tr>';
|
$out.= '<tr><td class="align-right">Source:</td><td class="align-left"><input type="text" id="src" name="src" size="20"></input><span id="behindSource">@Domain</span></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Destination').':</td><td class="align-left"><input type="text" id="dest" name="dest" size="20"></input></td></tr>';
|
$out.= '<tr><td class="align-right">Destination:</td><td class="align-left"><input type="text" id="dest" name="dest" size="20"></input></td></tr>';
|
||||||
$out.= '<tr><td class="align-right"><input type="button" ';
|
$out.= '<tr><td class="align-right"><input type="button" ';
|
||||||
$out .= 'onclick="var d=prompt(\'Insert domain\');';
|
$out .= 'onclick="var d=prompt(\'Insert domain\');';
|
||||||
switch($sel) {
|
switch($sel) {
|
||||||
|
@ -382,39 +316,39 @@ switch($new) {
|
||||||
$out .= 'if (d){document.querySelector(\'#src\').value=d+Math.floor((Math.random() * 89999) + 10000);
|
$out .= 'if (d){document.querySelector(\'#src\').value=d+Math.floor((Math.random() * 89999) + 10000);
|
||||||
';
|
';
|
||||||
$out .= 'document.querySelector(\'#dest\').value=\'nospam@jonny007-mkd.de\';}';
|
$out .= 'document.querySelector(\'#dest\').value=\'nospam@jonny007-mkd.de\';}';
|
||||||
$out .= '" value="NS"></input></td><td class="align-left"><input type="submit" value="'.retAl('Ok').'"></input></td></tr>';
|
$out .= '" value="NS"></input></td><td class="align-left"><input type="submit" value="Ok"></input></td></tr>';
|
||||||
$out.= '</table></form></div>';
|
$out.= '</table></form></div>';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$out = '<div style="text-align: center;"><span id="head">'.retAl('New Domain').'</span><form action="?do=5&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
$out = '<div style="text-align: center;"><span id="head">New Domain</span><form action="?do=5&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
||||||
$out.= '<table class="align-center"><tr><td class="align-right">'.retAl('Name').':</td><td class="align-left"><input type="text" name="new_domain" size="20"></input></td></tr>';
|
$out.= '<table class="align-center"><tr><td class="align-right">Name:</td><td class="align-left"><input type="text" name="new_domain" size="20"></input></td></tr>';
|
||||||
$out.= '<tr><td class="align-right"><input type="reset" value="'.retAl(''.retAl('Zurüksetzen').'').'"></input></td><td class="align-left"><input type="submit" value="'.retAl('Ok').'"></input></td></tr>';
|
$out.= '<tr><td class="align-right"><input type="reset" value="Zurüksetzen"></input></td><td class="align-left"><input type="submit" value="Ok"></input></td></tr>';
|
||||||
$out.= '</table></form></div>';
|
$out.= '</table></form></div>';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$sql = "SELECT id,name FROM " . $tbl_domains . ";";
|
$sql = "SELECT id,domain FROM domains;";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
$out = '<div style="text-align: center;"><span id="head">'.retAl('New User').'</span><form action="?do=6&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
$out = '<div style="text-align: center;"><span id="head">New User</span><form action="?do=6&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
||||||
$out.= '<table class="align-center"><tr><td class="align-right">'.retAl('Domain').':</td>';
|
$out.= '<table class="align-center"><tr><td class="align-right">Domain:</td>';
|
||||||
$out.= '<td class="align-left"><select name="domain" size="1">';
|
$out.= '<td class="align-left"><select name="domain" size="1">';
|
||||||
while($row = fetch($qry)) {
|
foreach(fetch($qry) as $row) {
|
||||||
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"';
|
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"';
|
||||||
$out.= ($row[0]==$sel) ? 'selected="selected">' : '>';
|
$out.= ($row[0]==$sel) ? 'selected="selected">' : '>';
|
||||||
$out.=$row[1].'</option>';
|
$out.=$row[1].'</option>';
|
||||||
}
|
}
|
||||||
$out.= '</select></td></tr>';
|
$out.= '</select></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Username').':</td><td class="align-left"><input type="text" name="usr" size="20"></input><span id="behindSource">@Domain</span></td></tr>';
|
$out.= '<tr><td class="align-right">Username:</td><td class="align-left"><input type="text" name="usr" size="20"></input><span id="behindSource">@Domain</span></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Password').':</td><td class="align-left"><input type="password" id="pwdInput" name="pwd" size="20"></input> <span id="behindPwd" onclick="mc.togglePwd(this);">'.retAl('show password').'</span></td></tr>';
|
$out.= '<tr><td class="align-right">Password:</td><td class="align-left"><input type="password" id="pwdInput" name="pwd" size="20"></input> <span id="behindPwd" onclick="mc.togglePwd(this);">show password</span></td></tr>';
|
||||||
$out.= '<tr><td class="align-right"><input type="reset" value="'.retAl('Zurüksetzen').'"></input></td><td class="align-left"><input type="submit" value="'.retAl('Ok').'"></input></td></tr>';
|
$out.= '<tr><td class="align-right"><input type="reset" value="Zurüksetzen"></input></td><td class="align-left"><input type="submit" value="Ok"></input></td></tr>';
|
||||||
$out.= '</table></form></div>';
|
$out.= '</table></form></div>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($do) {
|
switch($do) {
|
||||||
case 1:
|
case 1:
|
||||||
$thname = array(retAl('Action'),retAl('ID'),retAl('Source'),retAl('Domain'),retAl('Destination'),retAl('Enabled'));
|
$thname = array('Action','ID','Source','Domain','Destination','Enabled');
|
||||||
$thback = array('','id','source','domain_id','destination','enabled');
|
$thback = array('','alias_id','source','source_domain','destinations','enabled');
|
||||||
$out.= '<div><div style="text-align: center;"><div id="head">'.retAl('Alias Management').'</div><a href="?new=1&sel='.$sel.'&orderby='.$orderby.'">'.retAl('New Alias').'</a></div><br /><br />';
|
$out.= '<div><div style="text-align: center;"><div id="head">Alias Management</div><a href="?new=1&sel='.$sel.'&orderby='.$orderby.'">New Alias</a></div><br /><br />';
|
||||||
$out.='<table width="80%" class="table" rules="all"><tr>';
|
$out.='<table width="80%" class="table" rules="all"><tr>';
|
||||||
for ($a=0;$a<count($thname);$a++) {
|
for ($a=0;$a<count($thname);$a++) {
|
||||||
$idordered = ($orderby==$thback[$a]&&!($sel&&$thname[$a]=='Domain')) ? '" id="orderedby' : '';
|
$idordered = ($orderby==$thback[$a]&&!($sel&&$thname[$a]=='Domain')) ? '" id="orderedby' : '';
|
||||||
|
@ -423,17 +357,19 @@ switch($do) {
|
||||||
$out.='<th class="'.$thname[$a].$idordered.'">'.$link.$thname[$a].$endlink.'</th>';
|
$out.='<th class="'.$thname[$a].$idordered.'">'.$link.$thname[$a].$endlink.'</th>';
|
||||||
}
|
}
|
||||||
$out.='</tr>';
|
$out.='</tr>';
|
||||||
while($row = fetch($qry)) {
|
foreach(fetch($qry) as $row) {
|
||||||
$i++;
|
$i++;
|
||||||
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
|
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
|
||||||
$out.='<tr class="'.$rowcolor.'"><td class="Aktion"><a href="?chg=1&id='.$row[0].'&sel='.$sel.'&orderby='.$orderby.'" title="'.retAl('Change this record').'"><img src="edit.gif" alt="Edit" width="16" height="16"/></a><a href="?del=1&id='.$row[0].'&sel='.$sel.'" title="'.retAl('Delete this record').'"><img src="delete.gif" alt="Delete" width="16" height="16"/></a></td><td class="ID">'.$row[0].'</td><td class="Domain">'.$row[1].'</td><td class="Quelle">'.$row[2].'</td><td class="Ziel">'.$row[3].'</td><td class="Enabled">'.$row[4].'</td></tr>';
|
$out.='<tr class="'.$rowcolor.'"><td class="Aktion">';
|
||||||
|
if ($row[0] > 0) $out.='<a href="?chg=1&id='.$row[0].'&sel='.$sel.'&orderby='.$orderby.'" title="Change this record"><img src="edit.gif" alt="Edit" width="16" height="16"/></a><a href="?del=1&id='.$row[0].'&sel='.$sel.'" title="Delete this record"><img src="delete.gif" alt="Delete" width="16" height="16"/></a>';
|
||||||
|
$out.='</td><td class="ID">'.$row[0].'</td><td class="Domain">'.$row[1].'</td><td class="Quelle">'.$row[2].'</td><td class="Ziel">'.$row[3].'</td><td class="Enabled">'.$row[4].'</td></tr>';
|
||||||
}
|
}
|
||||||
$out.='</table></div>';
|
$out.='</table></div>';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$thname = array(retAl('Action'),retAl('ID'),retAl('Name'));
|
$thname = array('Action','ID','Name');
|
||||||
$thback = array('','id','name');
|
$thback = array('','id','domain');
|
||||||
$out.='<div><div style="text-align: center;"><div id="head">'.retAl('Domain Management').'</div><a href="?new=2&sel='.$sel.'&orderby='.$orderby.'">'.retAl('New Domain').'</a></div><br /><br />';
|
$out.='<div><div style="text-align: center;"><div id="head">Domain Management</div><a href="?new=2&sel='.$sel.'&orderby='.$orderby.'">New Domain</a></div><br /><br />';
|
||||||
$out.='<table width="40%" class="table" rules="all"><tr>';
|
$out.='<table width="40%" class="table" rules="all"><tr>';
|
||||||
for ($a=0;$a<count($thname);$a++) {
|
for ($a=0;$a<count($thname);$a++) {
|
||||||
$idordered = ($orderby==$thback[$a]) ? '" id="orderedby' : '';
|
$idordered = ($orderby==$thback[$a]) ? '" id="orderedby' : '';
|
||||||
|
@ -442,17 +378,17 @@ switch($do) {
|
||||||
$out.='<th class="'.$thname[$a].$idordered.'">'.$link.$thname[$a].$endlink.'</th>';
|
$out.='<th class="'.$thname[$a].$idordered.'">'.$link.$thname[$a].$endlink.'</th>';
|
||||||
}
|
}
|
||||||
$out.='</tr>';
|
$out.='</tr>';
|
||||||
while($row = fetch($qry)) {
|
foreach(fetch($qry) as $row) {
|
||||||
$i++;
|
$i++;
|
||||||
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
|
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
|
||||||
$out.='<tr class="'.$rowcolor.'"><td><a href="?chg=2&id='.$row[0].'&sel='.$sel.'&orderby='.$orderby.'" title="'.retAl('Change this record').'"><img src="edit.gif" alt="Edit" width="16" height="16"/></a><a href="?del=2&id='.$row[0].'&sel='.$sel.'" title="'.retAl('Delete this record').'"><img src="delete.gif" alt="Delete" width="16" height="16"/></a></td><td>'.$row[0].'</td><td>'.$row[1].'</td></tr>';
|
$out.='<tr class="'.$rowcolor.'"><td><a href="?chg=2&id='.$row[0].'&sel='.$sel.'&orderby='.$orderby.'" title="Change this record"><img src="edit.gif" alt="Edit" width="16" height="16"/></a><a href="?del=2&id='.$row[0].'&sel='.$sel.'" title="Delete this record"><img src="delete.gif" alt="Delete" width="16" height="16"/></a></td><td>'.$row[0].'</td><td>'.$row[1].'</td></tr>';
|
||||||
}
|
}
|
||||||
$out.='</table></div>';
|
$out.='</table></div>';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$thname = array(retAl('Action'),retAl('ID'),retAl('Domain'),retAl('User'));
|
$thname = array('Action','ID','User','Domain');
|
||||||
$thback = array("","id","domain_id","user");
|
$thback = array("","account_id","user","domain");
|
||||||
$out.='<div><div style="text-align: center;"><div id="head">'.retAl('User Management').'</div><a href="?new=3&sel='.$sel.'&orderby='.$orderby.'">'.retAl('New User').'</a></div><br /><br />';
|
$out.='<div><div style="text-align: center;"><div id="head">User Management</div><a href="?new=3&sel='.$sel.'&orderby='.$orderby.'">New User</a></div><br /><br />';
|
||||||
$out.='<table width="60%" class="table" rules="all"><tr>';
|
$out.='<table width="60%" class="table" rules="all"><tr>';
|
||||||
for ($a=0;$a<count($thname);$a++) {
|
for ($a=0;$a<count($thname);$a++) {
|
||||||
$idordered = ($orderby==$thback[$a]) ? '" id="orderedby' : '';
|
$idordered = ($orderby==$thback[$a]) ? '" id="orderedby' : '';
|
||||||
|
@ -461,41 +397,41 @@ switch($do) {
|
||||||
$out.='<th class="'.$thname[$a].$idordered.'">'.$link.$thname[$a].$endlink.'</th>';
|
$out.='<th class="'.$thname[$a].$idordered.'">'.$link.$thname[$a].$endlink.'</th>';
|
||||||
}
|
}
|
||||||
$out.='</tr>';
|
$out.='</tr>';
|
||||||
while($row = fetch($qry)) {
|
foreach(fetch($qry) as $row) {
|
||||||
$i++;
|
$i++;
|
||||||
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
|
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
|
||||||
$out.='<tr class="'.$rowcolor.'"><td><a href="?chg=3&id='.$row[0].'&sel='.$sel.'&orderby='.$orderby.'" title="'.retAl('Change this record').'"><img src="edit.gif" alt="Edit" width="16" height="16"/></a><a href="?del=3&id='.$row[0].'&sel='.$sel.'" title="'.retAl('Delete this record').'"><img src="delete.gif" alt="Delete" width="16" height="16"/></a></td><td>'.$row[0].'</td><td>'.$row[1].'</td><td>'.$row[2].'</td></tr>';
|
$out.='<tr class="'.$rowcolor.'"><td><a href="?chg=3&id='.$row[0].'&sel='.$sel.'&orderby='.$orderby.'" title="Change this record"><img src="edit.gif" alt="Edit" width="16" height="16"/></a><a href="?del=3&id='.$row[0].'&sel='.$sel.'" title="Delete this record"><img src="delete.gif" alt="Delete" width="16" height="16"/></a></td><td>'.$row[0].'</td><td>'.$row[1].'</td><td>'.$row[2].'</td></tr>';
|
||||||
}
|
}
|
||||||
$out.='</table></div>';
|
$out.='</table></div>';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if($result == true) {
|
if($result == true) {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('Alias').' '.retAl('was added...').'</b></div>';
|
$out = '<div style="text-align: center;"><b>Alias was added...</b></div>';
|
||||||
$out .= '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out .= '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><h3>'.retAl('ERROR adding Alias').'</h3></div>';
|
$out = '<div style="text-align: center;"><h3>ERROR adding Alias</h3></div>';
|
||||||
$out .= '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'" onclick="history.back(); return false;">'.retAl('Back').'</a></div>';
|
$out .= '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'" onclick="history.back(); return false;">Back</a></div>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if($result == true) {
|
if($result == true) {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('Domain').' '.retAl('was added...').'</b></div>';
|
$out = '<div style="text-align: center;"><b>Domain was added...</b></div>';
|
||||||
$out .= '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out .= '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><h3>'.retAl('ERROR adding Domain').'</h3></div>';
|
$out = '<div style="text-align: center;"><h3>ERROR adding Domain</h3></div>';
|
||||||
$out .= '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'" onclick="history.back(); return false;">'.retAl('Back').'</a></div>';
|
$out .= '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'" onclick="history.back(); return false;">Back</a></div>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if($result == true) {
|
if($result == true) {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('User').' '.retAl('was added...').'</b></div>';
|
$out = '<div style="text-align: center;"><b>User was added...</b></div>';
|
||||||
$out .= '<div style="text-align: center;"><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out .= '<div style="text-align: center;"><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><h3>'.retAl('ERROR adding User').'</h3></div>';
|
$out = '<div style="text-align: center;"><h3>ERROR adding User</h3></div>';
|
||||||
$out .= '<div style="text-align: center;"><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'" onclick="history.back(); return false;">'.retAl('Back').'</a></div>';
|
$out .= '<div style="text-align: center;"><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'" onclick="history.back(); return false;">Back</a></div>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -503,39 +439,39 @@ switch($do) {
|
||||||
switch($del) {
|
switch($del) {
|
||||||
case 1:
|
case 1:
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$out = '<div style="text-align: center;"><h3>'.retAl('Delete this alias?').'</h3><form action = "?del='.$del.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
$out = '<div style="text-align: center;"><h3>Delete this alias?</h3><form action = "?del='.$del.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
||||||
$out.= '<div><input type="submit" name="ack" value="'.retAl('No').'"></input> ǀ <input type="submit"name="ack" value="'.retAl('Yes').'"></input></div></form></div>';
|
$out.= '<div><input type="submit" name="ack" value="No"></input> ǀ <input type="submit"name="ack" value="Yes"></input></div></form></div>';
|
||||||
} else if($ack == retAl('Yes')) {
|
} else if($ack == 'Yes') {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('Alias').' '.retAl('was deleted...').'</b><br /><a href="?do=1">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><b>Alias was deleted...</b><br /><a href="?do=1">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$out = '<div style="text-align: center;"><h3>'.retAl('Delete this domain?').'</h3><form action = "?del='.$del.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">' . "\n";
|
$out = '<div style="text-align: center;"><h3>Delete this domain?</h3><form action = "?del='.$del.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">' . "\n";
|
||||||
$out.= '<div><input type="submit" name="ack" value="'.retAl('No').'" /> ǀ <input type="submit" name="ack" value="'.retAl('Yes').'" /></div></form></div>';
|
$out.= '<div><input type="submit" name="ack" value="No" /> ǀ <input type="submit" name="ack" value="Yes" /></div></form></div>';
|
||||||
} else if($ack == retAl('Yes')) {
|
} else if($ack == 'Yes') {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('Domain').' '.retAl('was deleted...').'</b><br /><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><b>Domain was deleted...</b><br /><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$out = '<div style="text-align: center;"><h3>'.retAl('Delete this user?').'</h3><form action = "?del='.$del.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">' . "\n";
|
$out = '<div style="text-align: center;"><h3>Delete this user?</h3><form action = "?del='.$del.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">' . "\n";
|
||||||
$out.= '<div><input type="submit" name="ack" value="'.retAl('No').'" /> ǀ <input type="submit" name="ack" value="'.retAl('Yes').'" /></div></form></div>';
|
$out.= '<div><input type="submit" name="ack" value="No" /> ǀ <input type="submit" name="ack" value="Yes" /></div></form></div>';
|
||||||
} else if($ack == retAl('Yes')) {
|
} else if($ack == 'Yes') {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('User').' '.retAl('was deleted...').'</b><br /><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><b>User was deleted...</b><br /><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><a href="?do=3">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><a href="?do=3">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -543,75 +479,76 @@ switch($del) {
|
||||||
|
|
||||||
switch($chg) {
|
switch($chg) {
|
||||||
case 1:
|
case 1:
|
||||||
$sql = "SELECT id,name FROM " . $tbl_domains . ";";
|
$sql = "SELECT id,domain FROM domains;";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
$sql = "SELECT * FROM " . $tbl_aliases . " WHERE id=".$id.";";
|
$sql = "SELECT id,source_username,source_domain,destination,enabled FROM aliases WHERE id=".$id.";";
|
||||||
$qry2 = query($sql);
|
$qry2 = query($sql);
|
||||||
$details = fetch($qry2);
|
$details = fetch($qry2);
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$out = '<div style="text-align: center;"><span id="head">'.retAl('Edit Alias').':</span><form action="?chg='.$chg.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
$out = '<div style="text-align: center;"><span id="head">Edit Alias:</span><form action="?chg='.$chg.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
||||||
$out.= '<table class="align-center">';
|
$out.= '<table class="align-center">';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Domain').':</td><td class="align-left"><select name="domain" size="1">';
|
$out.= '<tr><td class="align-right">Domain:</td><td class="align-left"><select name="domain" size="1">';
|
||||||
while($row = fetch($qry)) {
|
foreach(fetch($qry) as $row) {
|
||||||
$selected = ($row[0] == $details['domain_id']) ? ' selected="selected"' : '';
|
$selected = ($row[0] == $details['source_domain']) ? ' selected="selected"' : '';
|
||||||
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"'.$selected.'>'.$row[1].'</option>';
|
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"'.$selected.'>'.$row[1].'</option>';
|
||||||
}
|
}
|
||||||
$out.= '</select></td></tr>';
|
$out.= '</select></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Source').':</td><td class="align-left"><input type="text" name="src" size="20" value="'.$details['source'].'"></input><span id="behindSource">@Domain</span></td></tr>';
|
$out.= '<tr><td class="align-right">Source:</td><td class="align-left"><input type="text" name="src" size="20" value="'.$details['source_username'].'"></input><span id="behindSource">@Domain</span></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Target').':</td><td class="align-left"><input type="text" name="dest" size="20" value="'.$details['destination'].'"></input></td></tr>';
|
$out.= '<tr><td class="align-right">Target:</td><td class="align-left"><input type="text" name="dest" size="20" value="'.$details['destination'].'"></input></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Enabled').':</td><td class="align-left"><input type="text" name="enabled" size="1" value="'.$details['enabled'].'"></input></td></tr>';
|
$out.= '<tr><td class="align-right">Enabled:</td><td class="align-left"><input type="text" name="enabled" size="1" value="'.$details['enabled'].'"></input></td></tr>';
|
||||||
$out.= '<tr><td class="align-right"><input type="submit" name="ack" value="'.retAl('Cancel').'"></input></td><td class="align-left"><input type="submit" name="ack" value="'.retAl('Save').'"></input></td></tr></table></form></div>';
|
$out.= '<tr><td class="align-right"><input type="submit" name="ack" value="Cancel"></input></td><td class="align-left"><input type="submit" name="ack" value="Save"></input></td></tr></table></form></div>';
|
||||||
} else if($ack == retAl('Save')) {
|
} else if($ack == 'Save') {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('Alias').' '.('was changed...').'</b><br /><a href="?do=1">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><b>Alias was changed...</b><br /><a href="?do=1">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').' </a></div>';
|
$out = '<div style="text-align: center;"><a href="?do=1&sel='.$sel.'&orderby='.$orderby.'">Back </a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=1&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$sql = "SELECT name FROM " . $tbl_domains . " WHERE id=".$id.";";
|
$sql = "SELECT domain FROM domains WHERE id=".$id.";";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$dom = fetch($qry);
|
$dom = fetch($qry);
|
||||||
$out = '<div style="text-align: center;"><span id="head">'.retAl('Edit Domain').'</span><form action = "?chg='.$chg.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
$out = '<div style="text-align: center;"><span id="head">Edit Domain</span><form action = "?chg='.$chg.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
||||||
$out.= '<table class="align-center">';
|
$out.= '<table class="align-center">';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Domain').':</td><td class="align-left"><input type="text" name="domain" size="20" value="'.$dom['name'].'"></input>';
|
$out.= '<tr><td class="align-right">Domain:</td><td class="align-left"><input type="text" name="domain" size="20" value="'.$dom['domain'].'"></input>';
|
||||||
$out.= '</td></tr>';
|
$out.= '</td></tr>';
|
||||||
$out.= '<tr><td class="align-right"><input type="submit" name="ack" value="'.retAl('Cancel').'"></input></td>
|
$out.= '<tr><td class="align-right"><input type="submit" name="ack" value="Cancel"></input></td>
|
||||||
<td class="align-left"><input type="submit" name="ack" value="'.retAl('Save').'"></input></td></tr></table></form></div>';
|
<td class="align-left"><input type="submit" name="ack" value="Save"></input></td></tr></table></form></div>';
|
||||||
} else if($ack == retAl('Save')) {
|
} else if($ack == 'Save') {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('Domain').' '.('was changed...').'</b><br /><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><b>Domain was changed...</b><br /><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').' </a></div>';
|
$out = '<div style="text-align: center;"><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=2&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$sql = "SELECT id,name FROM " . $tbl_domains . ";";
|
$sql = "SELECT id,domain FROM domains;";
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
$sql = "SELECT * FROM " . $tbl_users . " WHERE id=".$id.";";
|
$sql = "SELECT username,domain,enabled FROM accounts WHERE id=".$id.";";
|
||||||
$qry2 = query($sql);
|
$qry2 = query($sql);
|
||||||
$details = fetch($qry2);
|
$details = fetch($qry2);
|
||||||
|
var_dump($details['domain']);
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$out = '<div style="text-align: center;"><span id="head">'.retAl('Edit User').'</span><form action="?chg='.$chg.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
$out = '<div style="text-align: center;"><span id="head">Edit User</span><form action="?chg='.$chg.'&id='.$id.'&sel='.$sel.'&orderby='.$orderby.'" method="post">';
|
||||||
$out.= '<table class="align-center">';
|
$out.= '<table class="align-center">';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Domain').':</td><td class="align-left"><select name="domain" size="1">';
|
$out.= '<tr><td class="align-right">Domain:</td><td class="align-left"><select name="domain" size="1">';
|
||||||
while($row = fetch($qry)) {
|
foreach(fetch($qry) as $row) {
|
||||||
$selected = ($details['domain_id'] == $row[0]) ? ' selected="selected"' : '';
|
$selected = ($details['domain'] == $row[0]) ? ' selected="selected"' : '';
|
||||||
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"'.$selected.'>'.$row[1].'</option>';
|
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"'.$selected.'>'.$row[1].'</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.= '</select></td></tr>';
|
$out.= '</select></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Name').':</td><td class="align-left"><input type="text"name="usr" size="20" value="'.$details['user'].'"></input><span id="behindSource">@Domain</span></td></tr>';
|
$out.= '<tr><td class="align-right">Name:</td><td class="align-left"><input type="text"name="usr" size="20" value="'.$details['username'].'"></input><span id="behindSource">@Domain</span></td></tr>';
|
||||||
$out.= '<tr><td class="align-right">'.retAl('Password').':</td><td class="align-left"><input type="password" id="pwdInput" name="pwd" size="20" value="" onclick="if(this.value==\'******\')this.value=\'\'"></input> <span id="behindPwd" onclick="mc.togglePwd(this);">'.retAl('show password').'</span></td></tr>';
|
$out.= '<tr><td class="align-right">Password:</td><td class="align-left"><input type="password" id="pwdInput" name="pwd" size="20" value="" onclick="if(this.value==\'******\')this.value=\'\'"></input> <span id="behindPwd" onclick="mc.togglePwd(this);">show password</span></td></tr>';
|
||||||
$out.= '<tr><td class="align-right"><input type="submit" name="ack" value="'.retAl('Cancel').'"></input></td><td class="align-left"><input type="submit" name="ack" value="'.retAl('Save').'"></input></td></tr></table></form></div>';
|
$out.= '<tr><td class="align-right"><input type="submit" name="ack" value="Cancel"></input></td><td class="align-left"><input type="submit" name="ack" value="Save"></input></td></tr></table></form></div>';
|
||||||
} else if($ack == retAl('Save')) {
|
} else if($ack == 'Save') {
|
||||||
$out = '<div style="text-align: center;"><b>'.retAl('User').' '.('was changed...').'</b><br /><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').'</a></div>';
|
$out = '<div style="text-align: center;"><b>User was changed...</b><br /><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},1000)\n--></script>";
|
||||||
} else {
|
} else {
|
||||||
$out = '<div style="text-align: center;"><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">'.retAl('Back').' </a></div>';
|
$out = '<div style="text-align: center;"><a href="?do=3&sel='.$sel.'&orderby='.$orderby.'">Back</a></div>';
|
||||||
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
$out .= "<script type=\"text/javascript\"><!--\nsetTimeout(function(){document.location = \"?do=3&sel=".$sel.'&orderby='.$orderby."\"},500)\n--></script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue