Having variables called 1, 2, 3... etc is really bad coding style and causes buckloads of issues in associative arrays.

Instead call them stuff like "role1", "role2" and so on.

svn path=/trunk/boinc/; revision=16132
This commit is contained in:
Janus B. Kristensen 2008-10-05 12:45:33 +00:00
parent 73b874ad26
commit 0da4c42976
2 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ for($i=1;$i<=mysql_num_rows($result);$i++){
<tr><td>$foo->name</td>";
for ($j=0;$j<=6;$j++) {
$bit = substr($foo->special_user, $j, 1);
echo "<td><input type=\"checkbox\" name=\"".$j."\" value=\"1\"";
echo "<td><input type=\"checkbox\" name=\"role".$j."\" value=\"1\"";
if ($bit == 1) {
echo " checked=\"checked\"";
}
@ -56,7 +56,7 @@ echo "<tr><form action=\"manage_special_users_action.php\" method=\"POST\">\n";
echo "<td>Add UserID:<input type=\"text\" name=\"userid\" size=\"6\"></td>";
for ($j=0;$j<=6;$j++) {
echo "<td><input type=\"checkbox\" name=\"".$j."\" value=\"1\"";
echo "<td><input type=\"checkbox\" name=\"role".$j."\" value=\"1\"";
echo "></td>\n";
}
echo "<td><input type=\"submit\" value=\"Update\"></form></td>";

View File

@ -26,7 +26,7 @@ admin_page_head("Manage special users action");
$bitset = '';
for ($i=0;$i<=6;$i++) {
if (post_int($i, TRUE) == '1') {
if (post_int("role".$i, TRUE) == '1') {
$bitset = str_pad($bitset, $i+1, '1');
} else {
$bitset = str_pad($bitset, $i+1, '0');