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();
|
2002-08-07 18:56:55 +00:00
|
|
|
|
2003-03-21 04:38:55 +00:00
|
|
|
$teamid = $_POST["teamid"];
|
2004-01-15 21:24:55 +00:00
|
|
|
$team = lookup_team($teamid);
|
2003-03-21 04:38:55 +00:00
|
|
|
require_team($team);
|
2002-08-07 18:56:55 +00:00
|
|
|
if ($user->teamid == $team->id) {
|
|
|
|
page_head("Unable to add $user->name");
|
2003-03-21 04:38:55 +00:00
|
|
|
echo "You are already a member of $team->name.";
|
2002-08-07 18:56:55 +00:00
|
|
|
} else {
|
2003-05-20 22:20:08 +00:00
|
|
|
$success = user_join_team($team,$user);
|
|
|
|
if ($success == true) {
|
|
|
|
page_head("Joined $team->name");
|
2003-03-21 04:38:55 +00:00
|
|
|
echo "You have joined
|
2003-05-20 22:20:08 +00:00
|
|
|
<a href=team_display.php?teamid=$team->id>$team->name</a>.
|
2003-03-21 04:38:55 +00:00
|
|
|
";
|
2002-08-07 18:56:55 +00:00
|
|
|
} else {
|
|
|
|
page_head("Error");
|
|
|
|
echo "Couldn't join team - please try later.\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
page_tail();
|
|
|
|
|
|
|
|
?>
|