"") && ($dest <> "")) $sql[4] = "INSERT INTO " . $tbl_aliases . " (domain_id, source, destination, enabled) VALUES ('$domain','$source','$dest',1);";
## Insert Domain Query ##
if($ndomain <> "") {
$sql0 = "SELECT name FROM " . $tbl_domains . " WHERE name = '$ndomain';";
$qr = query($sql0);
if(mysql_num_rows($qr) < 1) $sql[5] = "INSERT INTO " . $tbl_domains . " (name) VALUES ('$ndomain');";
}
## Insert User Query ##
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)."';";
$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)."');
";
}
## Delete Query ##
if(($del <> "") && ($id <> "") && ($ack == retAl('Yes'))) {
switch ($del) {
case 1: $tbl = $tbl_aliases; break;
case 2: $tbl = $tbl_domains; break;
case 3: $tbl = $tbl_users; break;
}
$sql = "DELETE FROM ".$tbl." WHERE id = $id;";
$qry = query($sql);
}
## Update Alias Query##
if(($chg == 1) && ($id <> "") && ($domain <> "") && ($dest <> "") && ($ack == retAl('Save'))) {
$sql = "UPDATE ".$tbl_aliases." SET domain_id = '".$domain."', source = '".$source."', destination = '".$dest."', enabled = '".$enabled."' WHERE id = ".$id.";";
$qry = query($sql);
}
## Update Domain Query ##
if(($chg == 2) && ($id <> "") && ($domain <> "") && ($ack == retAl('Save'))) {
$sql = "UPDATE ".$tbl_domains." SET name='".$domain."' WHERE id = ".$id.";";
$qry = query($sql);
}
## Update User Query ##
if(($chg == 3) && ($id <> "") && ($domain <> "") && ($usr <> "") && ($pwd <> "") && ($ack == retAl('Save'))) {
$sql = "UPDATE ".$tbl_users." SET domain_id ='".$domain."', user ='".$usr."', password = '".pw_encode($pwd)."' WHERE id = ".$id.";";
$qry = query($sql);
}
if($do) $qry = query($sql[$do]);
if($qry) $result = true;
else $result = false;
/* Code */
?>
Mail-Control
';
break;
case 2:
$out = '';
break;
case 3:
$sql = "SELECT id,name FROM " . $tbl_domains . ";";
$qry = query($sql);
$out = '';
break;
}
switch($do) {
case 1:
$thname = array(retAl('Action'),retAl('ID'),retAl('Source'),retAl('Domain'),retAl('Destination'),retAl('Enabled'));
$thback = array('','id','source','domain_id','destination','enabled');
$out.= '';
$out.='
';
for ($a=0;$a' : '';
$endlink = ($link) ? '' : '';
$out.=''.$link.$thname[$a].$endlink.' | ';
}
$out.='
';
while($row = fetch($qry)) {
$i++;
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
$out.=' | '.$row[0].' | '.$row[1].' | '.$row[2].' | '.$row[3].' | '.$row[4].' |
';
}
$out.='
';
break;
case 2:
$thname = array(retAl('Action'),retAl('ID'),retAl('Name'));
$thback = array('','id','name');
$out.='';
$out.='
';
for ($a=0;$a' : '';
$endlink = ($link) ? '' : '';
$out.=''.$link.$thname[$a].$endlink.' | ';
}
$out.='
';
while($row = fetch($qry)) {
$i++;
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
$out.=' | '.$row[0].' | '.$row[1].' |
';
}
$out.='
';
break;
case 3:
$thname = array(retAl('Action'),retAl('ID'),retAl('Domain'),retAl('User'));
$thback = array("","id","domain_id","user");
$out.='';
$out.='
';
for ($a=0;$a' : '';
$endlink = ($link) ? '' : '';
$out.=''.$link.$thname[$a].$endlink.' | ';
}
$out.='
';
while($row = fetch($qry)) {
$i++;
$rowcolor = ($i%2==0) ? 'rowcolor0' : 'rowcolor1';
$out.=' | '.$row[0].' | '.$row[1].' | '.$row[2].' |
';
}
$out.='
';
break;
case 4:
if($result == true) {
$out = ''.retAl('Alias').' '.retAl('was added...').'
';
$out .= '';
$out .= "";
} else {
$out = ''.retAl('ERROR adding Alias').'
';
$out .= '';
}
break;
case 5:
if($result == true) {
$out = ''.retAl('Domain').' '.retAl('was added...').'
';
$out .= '';
$out .= "";
} else {
$out = ''.retAl('ERROR adding Domain').'
';
$out .= '';
}
break;
case 6:
if($result == true) {
$out = ''.retAl('User').' '.retAl('was added...').'
';
$out .= '';
$out .= "";
} else {
$out = ''.retAl('ERROR adding User').'
';
$out .= '';
}
break;
}
switch($del) {
case 1:
if($ack == "") {
$out = ''.retAl('Delete this alias?').'
';
} else if($ack == retAl('Yes')) {
$out = '';
$out .= "";
} else {
$out = '';
$out .= "";
}
break;
case 2:
if($ack == "") {
$out = ''.retAl('Delete this domain?').'
';
} else if($ack == retAl('Yes')) {
$out = '';
$out .= "";
} else {
$out = '';
$out .= "";
}
break;
case 3:
if($ack == "") {
$out = ''.retAl('Delete this user?').'
';
} else if($ack == retAl('Yes')) {
$out = '';
$out .= "";
} else {
$out = '';
$out .= "";
}
break;
}
switch($chg) {
case 1:
$sql = "SELECT id,name FROM " . $tbl_domains . ";";
$qry = query($sql);
$sql = "SELECT * FROM " . $tbl_aliases . " WHERE id=".$id.";";
$qry2 = query($sql);
$details = fetch($qry2);
if($ack == "") {
$out = '';
} else if($ack == retAl('Save')) {
$out = '';
$out .= "";
} else {
$out = '';
$out .= "";
}
break;
case 2:
$sql = "SELECT name FROM " . $tbl_domains . " WHERE id=".$id.";";
$qry = query($sql);
if($ack == "") {
$dom = fetch($qry);
$out = '';
} else if($ack == retAl('Save')) {
$out = '';
$out .= "";
} else {
$out = '';
$out .= "";
}
break;
case 3:
$sql = "SELECT id,name FROM " . $tbl_domains . ";";
$qry = query($sql);
$sql = "SELECT * FROM " . $tbl_users . " WHERE id=".$id.";";
$qry2 = query($sql);
$details = fetch($qry2);
if($ack == "") {
$out = '';
} else if($ack == retAl('Save')) {
$out = '';
$out .= "";
} else {
$out = '';
$out .= "";
}
break;
}
echo $out;
?>