Credit & Info

These mods were made by Dite! They’re basically prerequisite mods to make others work, including some of the ones I’ve made. Just pop these into your mods.php somewhere.

Get Category

function get_category( $tcg, $category) {
    $database = new Database;
    $sanitize = new Sanitize;
    $tcg = $sanitize->for_db($tcg);
    $category = $sanitize->for_db($category);
    $altname = strtolower(str_replace(' ','',$tcg));

    $result = $database->get_assoc("SELECT `id` FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
    $tcgid = $result['id'];

    $result = $database->get_assoc("SELECT `cards` FROM `cards` WHERE `tcg`='$tcgid' AND 

    `category`='$category' LIMIT 1");
    return $result['cards'];
  }

Pending Check

function pending_check($tcg, $card){
    $database = new Database;
    $sanitize = new Sanitize;
    $tcg = $sanitize->for_db($tcg);

    $tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
    $tcgid = $tcginfo['id'];
    $pending = $database->num_rows("SELECT * FROM `trades` WHERE `tcg`='$tcgid' AND `receiving` LIKE '%$card%'");
    $pending = ($pending === 0 ? false : true);
    return $pending;
  }