name"); if ($team->name_html != null) { echo "

"; echo "$team->name_html"; } echo "

[id>Join] [id>Quit] [id>Edit*] [id>Remove Inactive Members*] [id>Disband Team*] [id>View Team Emails*]
* Team founder only

"; start_table(); row1("Team info"); if (strlen($team->description)) { row2("Description", sanitize_html($team->description)); } if (strlen($team->url)) {; row2("Web site", "url>http://$team->url"); } row2("Members", $team->nusers); $result = mysql_query("select * from user where teamid=$team->id"); $total_credit = 0; for ($i = 0; $i < $team->nusers; $i++) { $user = mysql_fetch_object($result); $total_credit = $total_credit + $user->total_credit; } row2("Total credit", $total_credit); $result = mysql_query("select * from user where id=$team->userid"); $user = mysql_fetch_object($result); row2("Founder", "id>$user->name"); row2("Country", $team->country); echo ""; echo "

"; start_table(); row1("Team members", 4); echo " Name Total credit Recent average credit Country "; $result = mysql_query("select * from user where teamid=$team->id order by expavg_credit desc"); $j = 1; while (true) { $user = mysql_fetch_object($result); if (!$user) break; echo " $j) id>$user->name $user->total_credit $user->expavg_credit $user->country "; $j++; } mysql_free_result($result); echo ""; page_tail(); } // requires that the team exist function require_team($team) { if (!$team) { page_head("Error"); echo "Team does not exist."; page_tail(); exit(); } } // requires that the user is logged in as the founder of // the team trying to be edited function require_founder_login($user, $team) { require_team($team); if ($user->id != $team->userid) { page_head("Permission denied"); echo "Only a team's founder may edit a team."; page_tail(); exit(); } } function team_table_start() { echo " Name Members Average credit Total credit Country "; } function show_team_row($team, $i) { echo " $i) id>$team->name $team->nusers $team->expavg_credit $team->total_credit $team->country \n"; } ?>