Exemple #1
0
$nb = mysql_num_rows($query);
$comment = '';
if ($nb != 1) {
    $comment = ' (' . mysql_num_rows($query) . ')';
}
echo '  <h1>' . $card_bdd['name'] . $comment . '</h1>';
?>
   <a href="../">Return to admin</a>
<?php 
echo '  <h2>#' . $card_bdd['id'] . '</h2>';
// Add to extension
if (array_key_exists('ext', $_GET)) {
    $query = query("SELECT id FROM extension WHERE `se` = '" . $_GET['ext'] . "'", 'ext2id');
    if ($arr = mysql_fetch_array($query)) {
        $ext_id = $arr['id'];
        if ($card = query_oneshot("SELECT * FROM `card_ext` WHERE `card` = '{$id}' AND `ext` = '{$ext_id}' ;")) {
            if (query("UPDATE `card_ext` SET `rarity` = '" . $_GET['rarity'] . "', `nbpics` = '" . $_GET['nbpics'] . "' WHERE `card` = '" . $card_bdd['id'] . "' AND `ext` = '{$ext_id}' LIMIT 1 ; ; ")) {
                echo '<p>Card successfully updated for extension ' . $_GET['ext'] . ' with rarity ' . $_GET['rarity'] . '</p>';
            } else {
                echo '<p>Impossible to update card for extension ' . $_GET['ext'] . ' with rarity ' . $_GET['rarity'] . '</p>';
            }
        } else {
            if (query("INSERT INTO `card_ext` (`card`, `ext`, `rarity`, `nbpics`) VALUES ( '" . $card_bdd['id'] . "', '{$ext_id}', '" . $_GET['rarity'] . "', '" . $_GET['nbpics'] . "') ; ")) {
                echo '<p>Card successfully added to extension ' . $_GET['ext'] . ' with rarity ' . $_GET['rarity'] . '</p>';
            } else {
                echo '<p>Impossible to add card to extension ' . $_GET['ext'] . ' with rarity ' . $_GET['rarity'] . '</p>';
            }
        }
    } else {
        echo '<p>Can\'t find extension ' . $_GET['ext'] . ' to add card to</p>';
    }
Exemple #2
0
<?php

if (array_key_exists('name', $_GET)) {
    include '../lib.php';
    include '../includes/db.php';
    include '../includes/card.php';
    $connec = card_connect();
    $query = query("SELECT * FROM card WHERE `name`='" . mysql_real_escape_string(card_name_sanitize($_GET['name'])) . "'", 'Card search', $connec);
    if ($card = mysql_fetch_object($query)) {
        $id = $card->id;
    } else {
        die('{"name": "' . $_GET['name'] . '"}');
    }
    if (array_key_exists('lang', $_GET) && $_GET['lang'] != 'en') {
        if ($lang = query_oneshot("SELECT * FROM cardname WHERE `lang` = '" . $_GET['lang'] . "' AND `card_id` = '{$id}'", 'Card language', $connec)) {
            $card->card_name = $lang->card_name;
        }
    }
    $query = query("SELECT extension.id, extension.se, extension.name, card_ext.nbpics FROM card_ext, extension WHERE card_ext.card = '{$id}' AND card_ext.ext = extension.id AND card_ext.nbpics > 0 ORDER BY extension.priority DESC", 'Card\' extension', $connec);
    $ext = array();
    while ($obj = mysql_fetch_object($query)) {
        $ext[] = $obj;
    }
    $card->ext = $ext;
    die(json_encode($card));
} else {
    die('No ID in param');
}
Exemple #3
0
<?php

include_once 'lib.php';
$id = param_or_die($_GET, 'id');
html_head('Admin > Tournament', array('style.css', 'admin.css'), array('lib/jquery.js', 'html.js', 'admin/tournament.js'));
?>

 <body>
<?php 
html_menu();
$t = query_oneshot("SELECT * FROM `tournament` WHERE `id` = '{$id}' ; ");
$data = json_decode($t->data);
?>
  <div class="section">
   <h1>Tournament : <?php 
echo $t->name;
?>
</h1>
   <h2>General data</h2>
   <form id="tournament_form" action="json.php">
    <input type="hidden" name="id" value="<?php 
echo $id;
?>
">
    <ul>
     <li>ID : <?php 
echo $t->id;
?>
</li>
     <li>Created : <?php 
echo $t->creation_date;
Exemple #4
0
<?php

include_once 'lib.php';
// Get IDs
if ($res = query_oneshot("SELECT `id` FROM `extension` WHERE `se` = 'CUB' ; ")) {
    $cub_id = $res->id;
}
if ($res = query_oneshot("SELECT `id` FROM `extension` WHERE `se` = 'CUBL' ; ")) {
    $cubl_id = $res->id;
}
if ($res = query_oneshot("SELECT `id` FROM `extension` WHERE `se` = 'CUBS' ; ")) {
    $cubs_id = $res->id;
}
// Cleanup
if (query("DELETE FROM `card_ext` WHERE `ext` = '{$cubl_id}' ; ")) {
    echo mysql_affected_rows() . ' cards removed from CUBL<br>';
}
if (query("DELETE FROM `card_ext` WHERE `ext` = '{$cubs_id}' ; ")) {
    echo mysql_affected_rows() . ' cards removed from CUBS<br>';
}
// Get
if ($cards = query_as_array("SELECT `card`, `rarity` FROM `card_ext` WHERE `ext` = '{$cub_id}' ; ")) {
    echo count($cards) . ' cards in CUB to dispatch<br>';
}
// Dispatch
$err = 0;
$cubl_nb = 0;
$cubs_nb = 0;
//while ( $card = mysql_fetch_object($cards) ) {
foreach ($cards as $card) {
    switch ($card->rarity) {
Exemple #5
0
            } else {
                echo '       <li>' . $key . ' : ' . $value . '(' . gettype($value) . ")</li>\n";
            }
        }
    }
}
$game = param($_GET, 'game', 0);
if ($game > 0) {
    $where = "WHERE `game` = '{$game}' ORDER BY `id` ASC";
} else {
    $nb = param($_GET, 'nb', 100);
    $where = "ORDER BY `id` DESC LIMIT 0,{$nb}";
}
$query = query("SELECT * FROM `action` {$where}");
while ($row = mysql_fetch_object($query)) {
    $game = query_oneshot("SELECT * FROM `round` WHERE `id` = '" . $row->game . "' ;");
    $nick = 'nobody';
    switch ($row->sender) {
        case $game->creator_id:
            $self = 'yes';
            $nick = $game->creator_nick;
            break;
        case $game->joiner_id:
            $self = 'no';
            $nick = $game->joiner_nick;
            break;
        case '':
            $self = 'little';
            $nick = 'server';
            break;
        default:
Exemple #6
0
?>
>Commons</option>
     <option <?php 
option_value("S", $rarity);
?>
>Specials</option>
    </select>
    <br>
    <input type="submit" value="Apply">
   </form>

<?php 
$card_connection = card_connect();
$p = array();
foreach ($report->cards as $i => $card) {
    $c = query_oneshot("SELECT `name`, `attrs`, `text` FROM `card` WHERE `id` = {$i}", 'Pick', $card_connection);
    $card->name = $c->name;
    $card->attrs = $c->attrs;
    $card->text = $c->text;
    if ($card->opened != 0) {
        $card->play_ratio = $card->played / $card->opened;
        $card->score_ratio = $card->scored / $card->opened / 2;
    } else {
        $card->play_ratio = 0;
        $card->score_ratio = 0;
    }
    if ($card->played != 0) {
        $card->play_score_ratio = $card->scored / $card->played / 2;
    } else {
        $card->play_score_ratio = 0;
    }