コード例 #1
0
         draw_ranking($players);
     }
     // started
     break;
     // case view
 // case view
 case 'join':
     check_banned($_SESSION['playerID']);
     $id = $_GET['id'];
     $t = mysql_fetch_array(mysql_query("SELECT * FROM tournaments WHERE id = '{$id}'"));
     $name = db_output($t['name']);
     if (strpos($name, "Finals") > 0) {
         echo "<b>Cannot join Finals</b>";
         exit;
     }
     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']))) {
コード例 #2
0
function joined($id, $player, $return = 0)
{

$query = "SELECT * FROM tournaments WHERE id = '$id'";

$t = mysql_query($query);
$t = mysql_fetch_array($t);

if ($t['players'] == 4)
{
    if ($t['player1'] == $player) $return = $t['id'];
         if ($t['player2'] == $player) $return = $t['id'];
         if ($t['player3'] == $player) $return = $t['id'];
         if ($t['player4'] == $player) $return = $t['id'];
}

elseif ($t['players'] == 16)
{
    // Holy shit, we got a BIG tournament
         $query2 = "SELECT * FROM tournaments WHERE big = '$id'";

         $b = mysql_query($query2);
         echo mysql_error();

         while ($big = mysql_fetch_array($b))
         {
                 if (!isset($return)) $return = 0;

                 $return = joined($big['id'], $player, $return);
         } // while
}

return $return;

}