function redeem_voucher($code) { global $is_logged_in; $code = trim($code); if (looks_like_mtgox_fiat_voucher($code)) { return redeem_mtgox_fiat_voucher($code); } if (!ENABLE_LOCAL_VOUCHERS) { throw Error('Vouchers are not enabled on this site', 'Redeeming voucher codes is disabled.'); } list($issuing_reqid, $issuing_uid, $amount, $curr_type) = check_voucher_code($code); // echo "issued in request $issuing_reqid by user $issuing_uid for amount $amount of $curr_type<br/>\n"; $query = "\n INSERT INTO requests (req_type, uid, amount, curr_type, status)\n VALUES ('DEPOS', '{$is_logged_in}', '{$amount}', '{$curr_type}', 'FINAL');\n "; do_query($query); $reqid = mysql_insert_id(); redeemed_voucher_code($issuing_reqid, $reqid); add_funds($is_logged_in, $amount, $curr_type); return array($curr_type, $amount); }
function redeem_voucher($code) { global $is_logged_in; $code = trim($code); if (looks_like_mtgox_fiat_voucher($code)) { return redeem_mtgox_fiat_voucher($code); } list($issuing_reqid, $issuing_uid, $amount, $curr_type) = check_voucher_code($code); // echo "issued in request $issuing_reqid by user $issuing_uid for amount $amount of $curr_type<br/>\n"; $query = "\n INSERT INTO requests (req_type, uid, amount, curr_type, status)\n VALUES ('DEPOS', '{$is_logged_in}', '{$amount}', '{$curr_type}', 'FINAL');\n "; do_query($query); $reqid = mysql_insert_id(); redeemed_voucher_code($issuing_reqid, $reqid); add_funds($is_logged_in, $amount, $curr_type); return array($curr_type, $amount); }