Several fixes
This commit is contained in:
parent
e9ddc55b6f
commit
42e25d903f
1 changed files with 21 additions and 20 deletions
|
@ -59,13 +59,13 @@ $new = array_key_exists('new', $_REQUEST) ? $_REQUEST['new'] : false;
|
||||||
$del = array_key_exists('del', $_REQUEST) ? $_REQUEST['del'] : false;
|
$del = array_key_exists('del', $_REQUEST) ? $_REQUEST['del'] : false;
|
||||||
$chg = array_key_exists('chg', $_REQUEST) ? $_REQUEST['chg'] : false;
|
$chg = array_key_exists('chg', $_REQUEST) ? $_REQUEST['chg'] : false;
|
||||||
$ack = array_key_exists('ack', $_REQUEST) ? $_REQUEST['ack'] : false;
|
$ack = array_key_exists('ack', $_REQUEST) ? $_REQUEST['ack'] : false;
|
||||||
$domain = array_key_exists('domain' , $_REQUEST) ? $_REQUEST['domain' ] : false;
|
$domain = array_key_exists('domain' , $_REQUEST) ? $_REQUEST['domain' ] : false;
|
||||||
$source = array_key_exists('source' , $_REQUEST) ? $_REQUEST['source' ] : false;
|
$source = array_key_exists('src' , $_REQUEST) ? $_REQUEST['src' ] : false;
|
||||||
$usr = array_key_exists('usr' , $_REQUEST) ? $_REQUEST['usr' ] : false;
|
$usr = array_key_exists('usr' , $_REQUEST) ? $_REQUEST['usr' ] : false;
|
||||||
$pwd = array_key_exists('pwd' , $_REQUEST) ? $_REQUEST['pwd' ] : false;
|
$pwd = array_key_exists('pwd' , $_REQUEST) ? $_REQUEST['pwd' ] : false;
|
||||||
$dest = array_key_exists('dest' , $_REQUEST) ? $_REQUEST['dest' ] : false;
|
$dest = array_key_exists('dest' , $_REQUEST) ? $_REQUEST['dest' ] : false;
|
||||||
$enabled = array_key_exists('enabled', $_REQUEST) ? $_REQUEST['enabled'] : false;
|
$enabled = array_key_exists('enabled' , $_REQUEST) ? $_REQUEST['enabled' ] : false;
|
||||||
$ndomain = array_key_exists('ndomain', $_REQUEST) ? $_REQUEST['ndomain'] : false;
|
$ndomain = array_key_exists('new_domain', $_REQUEST) ? $_REQUEST['new_domain'] : false;
|
||||||
$orderby = array_key_exists('orderby', $_REQUEST) ? $_REQUEST['orderby'] : false;
|
$orderby = array_key_exists('orderby', $_REQUEST) ? $_REQUEST['orderby'] : false;
|
||||||
$sel = array_key_exists('sel' , $_REQUEST) ? $_REQUEST['sel' ] : false;
|
$sel = array_key_exists('sel' , $_REQUEST) ? $_REQUEST['sel' ] : false;
|
||||||
|
|
||||||
|
@ -92,14 +92,14 @@ if(($domain <> "") && ($dest <> "")) $sql[4] = "INSERT INTO aliases (source_user
|
||||||
if($ndomain <> "") {
|
if($ndomain <> "") {
|
||||||
$sql0 = "SELECT domain FROM domains WHERE domain = '$ndomain';";
|
$sql0 = "SELECT domain FROM domains WHERE domain = '$ndomain';";
|
||||||
$qr = query($sql0);
|
$qr = query($sql0);
|
||||||
if($qr->num_rows() < 1) $sql[5] = "INSERT INTO domains (domain) 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 accounts WHERE domain = $domain AND username = '$usr';";
|
$sql1 = "SELECT domain_id, user, password FROM accounts WHERE domain = $domain AND username = '$usr';";
|
||||||
$qr = query($sql1);
|
$qr = query($sql1);
|
||||||
if($qr->num_rows() < 1) $sql[6] = "INSERT INTO accounts (domain, username, password, enabled) VALUES ('$domain','$usr','".pw_encode($pwd)."',1);";
|
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 ##
|
||||||
|
@ -275,7 +275,7 @@ a:hover, a:focus {
|
||||||
<option value=""><?php echo('All') ?></option>
|
<option value=""><?php echo('All') ?></option>
|
||||||
<?php
|
<?php
|
||||||
while ($dlist = $fetch_list->fetch_assoc()) {
|
while ($dlist = $fetch_list->fetch_assoc()) {
|
||||||
if ($dlist['id'] == $sel) echo ' <option value="'. $dlist['id'] .'" selected="selected">'. $dlist['domain'] .'</option>';
|
if ($dlist['id'] == $sel) echo ' <option value="'. $dlist['id'] .'" selected>'. $dlist['domain'] .'</option>';
|
||||||
else echo ' <option value="'. $dlist['id'] .'">'. $dlist['domain'].'</option>';
|
else echo ' <option value="'. $dlist['id'] .'">'. $dlist['domain'].'</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -297,8 +297,8 @@ switch($new) {
|
||||||
$out.= '<td class="align-left"><select name="domain" size="1">';
|
$out.= '<td class="align-left"><select name="domain" size="1">';
|
||||||
foreach(fetch($qry) as $row) {
|
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['id']==$sel) ? ' selected>' :'>';
|
||||||
$out.= $row[1].'</option>';
|
$out.= $row['domain'].'</option>';
|
||||||
}
|
}
|
||||||
$out.= '</select></td></tr>';
|
$out.= '</select></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">Source:</td><td class="align-left"><input type="text" id="src" name="src" size="20"></input><span id="behindSource">@Domain</span></td></tr>';
|
||||||
|
@ -333,8 +333,8 @@ switch($new) {
|
||||||
$out.= '<td class="align-left"><select name="domain" size="1">';
|
$out.= '<td class="align-left"><select name="domain" size="1">';
|
||||||
foreach(fetch($qry) as $row) {
|
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['id']==$sel) ? ' selected>' : '>';
|
||||||
$out.=$row[1].'</option>';
|
$out.=$row['domain'].'</option>';
|
||||||
}
|
}
|
||||||
$out.= '</select></td></tr>';
|
$out.= '</select></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">Username:</td><td class="align-left"><input type="text" name="usr" size="20"></input><span id="behindSource">@Domain</span></td></tr>';
|
||||||
|
@ -483,15 +483,16 @@ switch($chg) {
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
$sql = "SELECT id,source_username,source_domain,destination,enabled FROM 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)[0];
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$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 = '<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">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">';
|
||||||
foreach(fetch($qry) as $row) {
|
foreach(fetch($qry) as $row) {
|
||||||
$selected = ($row[0] == $details['source_domain']) ? ' selected="selected"' : '';
|
$selected = ($row['id'] == $details['source_domain']) ? ' selected' : '';
|
||||||
$out.= '<option value="'.$row[0].'" onclick="mc.setDomain(this.innerHTML)"'.$selected.'>'.$row[1].'</option>';
|
$out.= '<option value="'.$row['id'].'" onclick="mc.setDomain(this.innerHTML)"'.$selected.'>'.$row['domain'].'</option>';
|
||||||
}
|
}
|
||||||
|
var_dump($details);
|
||||||
$out.= '</select></td></tr>';
|
$out.= '</select></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">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">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>';
|
||||||
|
@ -509,7 +510,7 @@ switch($chg) {
|
||||||
$sql = "SELECT domain FROM 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)[0];
|
||||||
$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 = '<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">Domain:</td><td class="align-left"><input type="text" name="domain" size="20" value="'.$dom['domain'].'"></input>';
|
$out.= '<tr><td class="align-right">Domain:</td><td class="align-left"><input type="text" name="domain" size="20" value="'.$dom['domain'].'"></input>';
|
||||||
|
@ -529,14 +530,14 @@ switch($chg) {
|
||||||
$qry = query($sql);
|
$qry = query($sql);
|
||||||
$sql = "SELECT username,domain,enabled FROM accounts 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)[0];
|
||||||
var_dump($details['domain']);
|
var_dump($details['domain']);
|
||||||
if($ack == "") {
|
if($ack == "") {
|
||||||
$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 = '<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">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">';
|
||||||
foreach(fetch($qry) as $row) {
|
foreach(fetch($qry) as $row) {
|
||||||
$selected = ($details['domain'] == $row[0]) ? ' selected="selected"' : '';
|
$selected = ($details['domain'] == $row[0]) ? ' 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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue