Fixed bug in INSERT INTO users query
This commit is contained in:
parent
3b1cfb331e
commit
f37e6539ed
1 changed files with 18 additions and 13 deletions
|
@ -168,32 +168,37 @@ if($ndomain <> "") {
|
||||||
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 " . $tbl_users . " WHERE domain_id = $domain AND user = '$usr' AND password = '".pw_encode($pwd)."';";
|
||||||
$qr = query($sql1);
|
$qr = query($sql1);
|
||||||
if(mysql_num_rows($qr) < 1) $sql[6] = "INSERT INTO " . $tbl_users . " (domain_id, user, password) VALUES (NULL,'$domain','$usr','".pw_encode($pwd)."');
|
if(mysql_num_rows($qr) < 1) $sql[6] = "INSERT INTO " . $tbl_users . " (domain_id, user, password) VALUES ('$domain','$usr','".pw_encode($pwd)."');
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
## Delete Query ##
|
## Delete Query ##
|
||||||
if(($del <> "") && ($id <> "") && ($ack == retAl('Yes'))) {
|
if(($del <> "") && ($id <> "") && ($ack == retAl('Yes'))) {
|
||||||
$sql = "DELETE FROM ".$tbl[$del]." WHERE id = $id;";
|
switch ($del) {
|
||||||
query($sql);
|
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##
|
## Update Alias Query##
|
||||||
if(($chg == 1) && ($id <> "") && ($domain <> "") && ($dest <> "") && ($ack == retAl('Save'))) {
|
if(($chg == 1) && ($id <> "") && ($domain <> "") && ($dest <> "") && ($ack == retAl('Save'))) {
|
||||||
$sql = "UPDATE ".$tbl[$chg]." SET domain_id = '".$domain."', source = '".$source."', destination = '".$dest."', enabled = '".$enabled."' WHERE id = ".$id.";";
|
$sql = "UPDATE ".$tbl_aliases." SET domain_id = '".$domain."', source = '".$source."', destination = '".$dest."', enabled = '".$enabled."' WHERE id = ".$id.";";
|
||||||
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 == retAl('Save'))) {
|
||||||
$sql = "UPDATE ".$tbl[$chg]." SET name='".$domain."' WHERE id = ".$id.";";
|
$sql = "UPDATE ".$tbl_domains." SET name='".$domain."' WHERE id = ".$id.";";
|
||||||
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 == retAl('Save'))) {
|
||||||
$sql = "UPDATE ".$tbl[$chg]." SET domain_id ='".$domain."', user ='".$usr."', password = '".pw_encode($pwd)."' WHERE id = ".$id.";";
|
$sql = "UPDATE ".$tbl_users." SET domain_id ='".$domain."', user ='".$usr."', password = '".pw_encode($pwd)."' WHERE id = ".$id.";";
|
||||||
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;
|
||||||
|
@ -469,8 +474,8 @@ switch($do) {
|
||||||
$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.'">'.retAl('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>'.retAl('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;">'.retAl('Back').'</a></div>';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -499,7 +504,7 @@ 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>'.retAl('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> |#448; <input type="submit"name="ack" value="'.retAl('Yes').'"></input></div></form></div>';
|
$out.= '<div><input type="submit" name="ack" value="'.retAl('No').'"></input> ǀ <input type="submit"name="ack" value="'.retAl('Yes').'"></input></div></form></div>';
|
||||||
} else if($ack == retAl('Yes')) {
|
} else if($ack == retAl('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>'.retAl('Alias').' '.retAl('was deleted...').'</b><br /><a href="?do=1">'.retAl('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>";
|
||||||
|
@ -512,7 +517,7 @@ switch($del) {
|
||||||
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>'.retAl('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').'" /> |#448; <input type="submit" name="ack" value="'.retAl('Yes').'" /></div></form></div>';
|
$out.= '<div><input type="submit" name="ack" value="'.retAl('No').'" /> ǀ <input type="submit" name="ack" value="'.retAl('Yes').'" /></div></form></div>';
|
||||||
} else if($ack == retAl('Yes')) {
|
} else if($ack == retAl('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>'.retAl('Domain').' '.retAl('was deleted...').'</b><br /><a href="?do=2&sel='.$sel.'&orderby='.$orderby.'">'.retAl('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>";
|
||||||
|
|
Loading…
Reference in a new issue