$coc = 0;
$lic = 0;
$juc = 0;
if ($games) {
    $now = time();
    $allc = count($games);
    foreach ($games as $g) {
        $no_skip = false;
        $startdate = date('m/d/Y h:i A', $g['g_schedFrom']);
        $closedate = date('m/d/Y h:i A', $g['g_schedTo']);
        $title = $g['g_title'];
        if (strlen($title) > 30) {
            $title = substr($title, 0, 30) . '...';
        }
        $no_detail = false;
        $stat = getGameStatus($g, $lang);
        if ($stat == $lang[61]) {
            // draft
            $no_skip = $filter == 'draft' ? true : false;
            $drc++;
            $bg = "bg-purple";
            $status = $lang[61];
            $no_detail = true;
        } elseif ($stat == $lang[54]) {
            // closed
            $no_skip = $filter == 'closed' ? true : false;
            $clc++;
            $bg = "bg-gray";
            $status = $lang[54];
        } elseif ($stat == $lang[62]) {
            // cancelled
Beispiel #2
0
function updatePoints($id, $user, $pointbonus)
{
    $playerpoint = getPlayerColor($id, $user);
    if ($playerpoint == "red") {
        $playerpoint = "PointsR";
        $playerpoint2 = "PointsB";
        $opponent = "PlayerBlue";
    } else {
        $playerpoint = "PointsB";
        $playerpoint2 = "PointsR";
        $opponent = "PlayerRed";
    }
    $sql = "SELECT " . $playerpoint . " FROM field WHERE FieldID = '{$id}'";
    $result = mysql_query($sql);
    if ($result) {
        while ($ar = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $points = $ar[$playerpoint];
        }
    }
    $points = $points + $pointbonus;
    $sql = "UPDATE field SET " . $playerpoint . "='{$points}' WHERE FieldID = '{$id}'";
    mysql_query($sql);
    //Win-Condition
    $field = new hand(getField($id), true);
    $fieldcards = $field->countHand();
    $status = getGameStatus($id);
    if (($points > 36 || $fieldcards == 36) && $status == 1) {
        $sql = "SELECT " . $playerpoint2 . " FROM field WHERE FieldID = '{$id}'";
        $result = mysql_query($sql);
        if ($result) {
            while ($ar = mysql_fetch_array($result, MYSQL_ASSOC)) {
                $points2 = $ar[$playerpoint2];
            }
        }
        $sql = "SELECT " . $opponent . " FROM field WHERE FieldID = '{$id}'";
        $result = mysql_query($sql);
        if ($result) {
            while ($ar = mysql_fetch_array($result, MYSQL_ASSOC)) {
                $player = $ar[$playerpoint2];
            }
        }
        if ($points == $points2) {
            drawgame($id, $user, $player);
        } elseif ($points > $points2) {
            $playercolor = getPlayerColor($id, $user);
            wingame($id, $user, $player, $playercolor);
        } else {
            $playercolor = getPlayerColor($id, $player);
            wingame($id, $player, $user, $playercolor);
        }
    }
}
if (!$game_id) {
    header('Location: ' . $baseurl . '/admin/games?lang=' . $LANGUAGE);
    exit;
}
$game = getGame($game_id);
$is_closed = $game['g_isClosed'];
$is_cancelled = $game['g_isCancelled'];
$disable_el = ($is_closed or $is_cancelled) ? "disabled" : '';
$all_bets = getAllBets($game_id);
if (!$game) {
    header('Location: ' . $baseurl . '/admin/games?lang=' . $LANGUAGE);
    exit;
}
$info_per_bet_item = getInfoPerBetItem($all_bets);
// get placed coins, bet users, and ratio
$game_status = getGameStatus($game, $lang);
$bet_items = getBetItems($game_id);
if ($game_status == $lang[53]) {
    // judgement
    $alert_disp = 'block';
} else {
    $alert_disp = 'none';
}
foreach ($bet_items as $bi) {
    $bet_items2[$bi['bi_id']] = $bi['bi_description'];
    // assign bi_id as key and bi_description as value
}
$info_per_bet_item_by_username = getInfoPerBetItemByUsername($all_bets, $bet_items2);
?>
<!DOCTYPE html>
<html>
Beispiel #4
0
if (isset($_GET["join"])) {
    $deck = $_GET["deck"];
    joinGame($id, getUserID(), $deck);
}
/**********************************************************************************************************************
 * Is the user player blue or player red? (or spectator)? (+Game Status)
 **********************************************************************************************************************/
$redplayer = false;
if (getRedPlayer($id) == getUserID($id)) {
    $redplayer = true;
}
$blueplayer = false;
if (getBluePlayer($id) == getUserID($id)) {
    $blueplayer = true;
}
$gamestatus = getGameStatus($id);
$bluewin = "";
$redwin = "";
if ($gamestatus == 2) {
    $bluewin = "lost.";
    $redwin = "WON!";
}
if ($gamestatus == 3) {
    $bluewin = "WON!";
    $redwin = "lost.";
}
if ($gamestatus == 5) {
    $bluewin = "draw.~";
    $redwin = "draw.~";
}
$players = getGamePlayers($id);