Exemple #1
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');
}
$mask = param($_GET, 'mask', '');
$imask = param($_GET, 'imask', '');
if (!ereg('([0-9]{4})-([0-9]{2})-([0-9]{2})', $date)) {
    $date = '';
}
$folder = '../../stats/';
$file = $folder . $name;
if ($exts == '') {
    $exts = array();
} else {
    $exts = explode(',', $exts);
    foreach ($exts as $i => $ext) {
        $exts[$i] = trim($ext);
    }
}
$card_connection = card_connect();
// All decks from all sealed events
$q = "SELECT\n\t`tournament`.`id`,\n\t`tournament`.`name`,\n\t`tournament`.`creation_date`,\n\t`tournament`.`data`\nFROM\n\t`tournament`\nWHERE\n\t`tournament`.`min_players` > 1\n\tAND `tournament`.`status` = 6";
echo '<ul>';
if ($date != '') {
    $q .= " AND `tournament`.`creation_date` > '{$date}'";
    echo "<li>Selection by date : {$date}</li>";
}
if ($format != '') {
    $q .= " AND `tournament`.`type` = '{$format}'";
    echo "<li>Selection by format : {$format}</li>";
}
if (count($exts) > 0) {
    echo "<li>Selection by extensions : " . implode(', ', $exts) . "</li>";
}
if ($mask != '') {
Exemple #3
0
<?php

include '../lib.php';
include '../includes/db.php';
include '../includes/card.php';
die(json_encode(card_search($_GET, card_connect())));