2002-08-07 18:56:55 +00:00
|
|
|
<?php
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once("../inc/db.inc");
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/team.inc");
|
2002-08-07 18:56:55 +00:00
|
|
|
|
|
|
|
db_init();
|
2003-03-19 21:01:32 +00:00
|
|
|
$user = get_logged_in_user();
|
2004-01-15 21:24:55 +00:00
|
|
|
$teamid = $_POST["id"];
|
2002-12-16 21:41:41 +00:00
|
|
|
|
2004-01-14 20:24:24 +00:00
|
|
|
$team = lookup_team($teamid);
|
2002-08-07 18:56:55 +00:00
|
|
|
if ($user->teamid == $team->id) {
|
2004-01-14 20:24:24 +00:00
|
|
|
$query_user_table = "update user set teamid = 0 where id = $user->id";
|
2002-08-07 18:56:55 +00:00
|
|
|
$result_user_table = mysql_query($query_user_table);
|
2004-01-14 20:24:24 +00:00
|
|
|
$query_team_table = "update team set nusers=nusers-1 where id=$team->id";
|
2002-08-07 18:56:55 +00:00
|
|
|
$result_team_table = mysql_query($query_team_table);
|
|
|
|
if ($result_user_table && $result_team_table) {
|
|
|
|
$team_name = $team->name;
|
|
|
|
page_head("Quit $team_name");
|
|
|
|
echo "<h2>Removed from team</h2>";
|
2003-03-21 04:38:55 +00:00
|
|
|
echo "You have been removed from <a href=team_display.php?teamid=$team->id>$team_name</a>";
|
2002-08-07 18:56:55 +00:00
|
|
|
} else {
|
|
|
|
page_head("Error");
|
|
|
|
echo "Couldn't quit team - please try later.\n";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
page_head("Unable to remove $user->name");
|
2002-08-12 20:16:55 +00:00
|
|
|
echo "$user->name is not a member of $team_name.\n";
|
2002-08-07 18:56:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
page_tail();
|
|
|
|
|
|
|
|
?>
|