We used a mixture of account type IDs and account type descriptions in
the account edit page. This resulted in the account type field always
defaulting to "Normal user" after an invalid form had been submitted.

Consistently use account type IDs to avoid this.

Signed-off-by: Lukas Fleischer <archli...@cryptocrack.de>
---
 web/html/account.php               | 2 +-
 web/template/account_edit_form.php | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/web/html/account.php b/web/html/account.php
index 786ae02..1192da6 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -54,7 +54,7 @@ if (isset($_COOKIE["AURSID"])) {
                                $row["AccountType"] != "Developer") ||
                                ($row["ID"] == 
uid_from_sid($_COOKIE["AURSID"]))) {
                                display_account_form($atype, "UpdateAccount", 
$row["Username"],
-                                       $row["AccountType"], $row["Suspended"], 
$row["Email"],
+                                       $row["AccountTypeID"], 
$row["Suspended"], $row["Email"],
                                        "", "", $row["RealName"], 
$row["LangPreference"],
                                        $row["IRCNick"], $row["PGPKey"], 
$row["ID"]);
                        } else {
diff --git a/web/template/account_edit_form.php 
b/web/template/account_edit_form.php
index 6c39d53..a41b34c 100644
--- a/web/template/account_edit_form.php
+++ b/web/template/account_edit_form.php
@@ -22,12 +22,12 @@
                <p>
                        <label for="id_type"><?= __("Account Type") ?>:</label>
                        <select name="T" id="id_type">
-                               <?php if ($T == "User"): ?>
+                               <?php if ($T == 1): ?>
                                <option value="1" selected="selected"><?= 
__("Normal user") ?></option>
                                <?php else: ?>
                                <option value="1"><?= __("Normal user") 
?></option>
                                <?php endif; ?>
-                               <?php if ($T == "Trusted User"): ?>
+                               <?php if ($T == 2): ?>
                                <option value="2" selected="selected"><?= 
__("Trusted user") ?></option>
                                <?php else: ?>
                                <option value="2"><?= __("Trusted user") 
?></option>
@@ -37,7 +37,7 @@
                                if ($UTYPE == "Developer"):
                                ?>
                                <option value="3"
-                               <?php $T == "Developer" ? print " 
selected=\"selected\">" : print ">";
+                               <?php $T == 3 ? print " selected=\"selected\">" 
: print ">";
                                print __("Developer")."\n"; ?>
                                </option>
                                <?php endif; ?>
-- 
1.8.0

Reply via email to