the problem: Humans are not superior to robots like Taeyong. We must invent these robots to do things more efficiently and counter our human error. Counting trades and stampcards is one of those areas where we're likely to exhibit this human side of ourselves.
the solution: Automatically count cards traded. Completely optional. Not necessary. You still need to separate out logs to submit stampcards.
caveats: This script works by counting "Traded" and commas in your trade log. You cannot have commas in the date format (you can swap out by going to yoru TCG settings and changing format, and by finding and replacing your existing log). Assumes your trade log is called 'tradelog' in etcg. Cannot be using archived logs (you can edit this to work around that).
function count_logs( $tcg, $type ) { // function to count the cards traded
if ( $type == 'activitylog' || $type == 'activitylogarch' || $type == 'tradelog' || $type == 'tradelogarch' ) {
$database = new Database;
$sanitize = new Sanitize;
$tcg = $sanitize->for_db($tcg);
$log = $database->get_assoc("SELECT `$type` FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
$tradeamount = preg_match_all( "/Traded/", $log[$type] ); // counts amount of trades as denoted by the Traded portion of the log
$commas = preg_match_all( "/,/", $log[$type] ) / 2; // counts commas and divides by two to account for multi-card trades
return $tradeamount + $commas; // adds, which I can't do because I can't read
}
else {
return false;
}
}
cards traded: <?php echo count_logs('TCGNAMEHERE','tradelog'); ?>