diff --git a/mozilla/webtools/update/developers/usermanager.php b/mozilla/webtools/update/developers/usermanager.php index 516cef34c1d..2006448de00 100755 --- a/mozilla/webtools/update/developers/usermanager.php +++ b/mozilla/webtools/update/developers/usermanager.php @@ -24,29 +24,35 @@ include"inc_sidebar.php"; MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); - if (mysql_num_rows($sql_result)=="0") { - echo"

Error Accessing Record

\n"; - echo"You do not appear to have permission to edit this record.
\n"; - echo"«« Go Back\n"; - include"$page_footer"; - echo"\n\n"; - exit; - } else { - $row = mysql_fetch_array($sql_result); - $userid = $row["UserID"]; + $postuid = escape_string($_GET["userid"]); + $userid = escape_string($_SESSION["uid"]); + // All users users may change their own accounts, check when trying to change other accounts + if ($postuid and $postuid != $userid) { + $allowed = false; + if ($_SESSION["level"] == "admin") { + // Admins may change any account + $allowed = true; + } else if ($_SESSION["level"]=="editor") { + // Editors may only change regular users, not editors or admins + $sql = "SELECT `UserID` from `userprofiles` WHERE " . + "`UserMode`='U' and `UserID`='$postuid'" . + " LIMIT 1"; + $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE); + if (mysql_num_rows($sql_result) == 1) { + $allowed = true; + } + } + + if ($allowed == false) { + echo"

Error Accessing Record

\n"; + echo"You do not appear to have permission to edit this record.
\n"; + echo"«« Go Back\n"; + include"$page_footer"; + echo"\n\n"; + exit; + } else { + $userid = $postuid; } - } else { - $userid = escape_string($_GET["userid"]); } } ?>