2002-08-07 18:56:55 +00:00
|
|
|
<?php
|
|
|
|
|
2003-08-22 05:36:25 +00:00
|
|
|
require_once("db.inc");
|
2002-08-07 18:56:55 +00:00
|
|
|
require_once("util.inc");
|
|
|
|
require_once("team.inc");
|
|
|
|
|
|
|
|
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"];
|
|
|
|
$result = mysql_query("select * from team where id = $teamid");
|
2002-08-07 18:56:55 +00:00
|
|
|
$team = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
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 "<h2>Joined team</h2>";
|
|
|
|
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();
|
|
|
|
|
|
|
|
?>
|