Error: You don't have finduser(codetrace) priv." unless LJ::check_priv($remote, "finduser", "codetrace"); if ($FORM{'user'} ne "") { $mode = "user"; $FORM{'code'} = ""; } elsif ($FORM{'code'}) { $mode = "code"; } p("
Codes made/used by $user:"); $rec_user->($rec_user, $u->{'userid'}, 1); p("
Total children: $total_children");
return $ret;
}
if ($mode eq "code")
{
my $code = $FORM{'code'};
my $acid;
if ($code =~ /^\#(\d+)$/) {
$acid = $1;
$code = LJ::acid_encode($acid);
} else {
return "Bogus code." if length($code) != 7 && length($code) != 12;
$code =~ s/^.....(.......)$/$1/;
$acid = LJ::acid_decode($code);
}
p("Code: $code = $acid
");
my $ac = $dbr->selectrow_hashref("SELECT userid, rcptid FROM acctcode WHERE acid=$acid");
unless ($ac) {
p("Code doesn't exist");
return $ret;
}
my $ai = $dbr->selectrow_hashref("SELECT reason, dateadd FROM acctinvite WHERE acid=$acid");
$ac->{'user'} = LJ::get_username($ac->{'userid'})
if $ac->{'userid'};
$ac->{'ruser'} = LJ::get_username($ac->{'rcptid'})
if $ac->{'rcptid'};
p("Creator of code: $ac->{'user'} ($ai->{'reason'}, $ai->{'dateadd'})
")
if $ac->{'user'};
unless ($ac->{'userid'}) {
my $ap = $dbr->selectrow_hashref(qq{
SELECT p.userid, p.payid FROM payments p, acctpay ap
WHERE ap.payid=p.payid AND ap.acid=$acid
});
$ap ||= $dbr->selectrow_hashref(qq{
SELECT p.userid, p.payid FROM payments p, payitems pi, acctpayitem api
WHERE api.piid=pi.piid AND api.acid=$acid AND pi.payid=p.payid
});
if ($ap) {
p("Payment which generated code: {'userid'}'>$ap->{'payid'}
");
}
}
p("Code recipient: $ac->{'ruser'}
");
return $ret;
}
$ret;
_code?>