}
 if (joined($id, $_SESSION['playerID'])) {
     echo "<b>{$MSG_LANG['tournamentalready']}</b>";
     exit;
 }
 if (get_num($id) == $t['players']) {
     echo "<b>{$MSG_LANG['tournament44']}</b>";
     exit;
 }
 if ($me['rating'] < $t['min_rating'] || $me['rating'] > $t['max_rating']) {
     echo "<b>{$MSG_LANG['tournamentsorry']}</b>";
     exit;
 }
 include "groups_functions.php";
 $uh = get_group($me['playerID']);
 $ug = get_groupdata($uh['group_id']);
 if ($t['access'] != "" && ($t['access'] == "group" && $uh == false) && ($t['access'] == "group_ag" && $ug['ag'] == 0) && (is_numeric($t['access']) && ($t['access'] = !$uh['group_id']))) {
     echo "You may not join this tournament";
     exit;
 }
 // find out where to join
 if ($t['players'] == 4) {
     // Thank god, we got a small tournament
     $field = '';
     for ($i = 2; $i < 5; $i++) {
         if ($t['player' . $i] == 0 && $field == '') {
             $field = 'player' . $i;
         }
     }
     mysql_query("UPDATE tournaments set " . $field . " = '" . $_SESSION['playerID'] . "' WHERE id = '{$id}'");
     // That was the easy part, now create the games
}

if (empty($feedback))
{
    echo "No answer selected.";
    exit;
}

if (!is_groupcreator($group, $me['playerID']))
{
    echo "You are not the director/conductor of the group.";
    exit;
}

// Mail an den Gruppenleiter
    $g = get_groupdata($group);
    $tq = mysql_query("SELECT email, firstName FROM players WHERE playerID = '$id'");
    $toer = mysql_fetch_array($tq);
    $tomail = $toer['email'];
    $toname = $toer['firstName'];

    $totitle = 'Bitte um Aufnahme in deine Gruppe';

if ($feedback == 1)
{
    $query = "UPDATE group_members SET joined = '$time' WHERE group_id = '$group' AND playerID = '$id'";

    $text = "Hallo ".$toname.",

You have been accepted in the ".$g['title']."";