\n";
$result = mysql_query("select id, nusers from team");
while ($team = mysql_fetch_object($result)) {
$q = "select count(*) from user where teamid=$team->id";
if ($credit_only) $q .= " and total_credit>0";
echo $q . "
";
$r = mysql_query($q);
$x = mysql_fetch_array($r);
mysql_free_result($r);
$n = $x[0];
if ($n != $team->nusers) {
echo "team $team->id: old: $team->nusers new: $n
\n";
mysql_query("update team set nusers=$n where id=$team->id");
}
}
mysql_free_result($result);
echo "set_nusers() finished!
";
}
db_init();
$use = $_GET['use'];
admin_page_head("Repair team nusers");
if ($use < 1 || $use >2) {
echo "
Script to recalculate the number of users in a team.
Please choose:
Consider every user
Consider only user with total_credit>0
";
} else {
if ($use == 1) {
set_nusers(FALSE);
} else {
set_nusers(TRUE);
}
}
admin_page_tail();
?>