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 <> "")) {
|
||||
$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 (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 ##
|
||||
if(($del <> "") && ($id <> "") && ($ack == retAl('Yes'))) {
|
||||
$sql = "DELETE FROM ".$tbl[$del]." WHERE id = $id;";
|
||||
query($sql);
|
||||
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[$chg]." SET domain_id = '".$domain."', source = '".$source."', destination = '".$dest."', enabled = '".$enabled."' WHERE id = ".$id.";";
|
||||
query($sql);
|
||||
$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[$chg]." SET name='".$domain."' WHERE id = ".$id.";";
|
||||
query($sql);
|
||||
$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[$chg]." SET domain_id ='".$domain."', user ='".$usr."', password = '".pw_encode($pwd)."' WHERE id = ".$id.";";
|
||||
query($sql);
|
||||
$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;
|
||||
|
@ -499,7 +504,7 @@ switch($del) {
|
|||
case 1:
|
||||
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><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')) {
|
||||
$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>";
|
||||
|
@ -512,7 +517,7 @@ switch($del) {
|
|||
case 2:
|
||||
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><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')) {
|
||||
$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>";
|
||||
|
|
Loading…
Reference in a new issue