Generate Coupon body<= {'legal_assignagree'}; if ($GET{'cpid'}) { my $cp = $dbh->selectrow_hashref("SELECT * FROM coupon WHERE cpid=? AND rcptid=?", undef, $GET{'cpid'}, $remote->{'userid'}); return "Error: Coupon not found" unless $cp; return "\$$cp->{'arg'}:
$cp->{'cpid'}-$cp->{'auth'}
p?>payment history. p?>"; } my $amt = $POST{'amt'}; unless ($amt =~ /^(\d+)(\.(\d\d))?$/) { return "Error: Invalid format."; } if ($amt < 5 || $amt > 25) { return "Error: Amount must be between \$5.00 and \$25.00."; } if (LJ::Pay::bazaar_remove_balance($remote, $amt)) { my $auth = LJ::make_auth_code(10); $dbh->do("INSERT INTO coupon (auth, type, arg, rcptid, locked, payid) VALUES (?, 'dollaroff', ?, ?, '0', 0)", undef, $auth, $amt, $remote->{'userid'}); die $dbh->errstr if $dbh->err; my $id = $dbh->{'mysql_insertid'}; my $coupon = "$id-$auth"; $dbh->do("INSERT INTO bzrpayout (userid, date, amt, method, note) VALUES (?, NOW(), ?, 'coupon', ?)", undef, $remote->{'userid'}, $amt, "coupon: $coupon"); return BML::redirect("gencoupon.bml?cpid=$id"); } else { return "You don't have \$$amt in your balance. If you did a double submit, you can get your coupon code on your payment history."; } } _code?> <=body page?>