Description:
Enter an email address, look up a username.
Designed for the admin tool box. empty box is a box
with just |content| as its contents.
Box Code:
return '' unless ($S->have_perm('edit_user'));
my $email = $S->cgi->param('email');
my $vars = $S->cgi->Vars();
my $args;
foreach my $key (keys %{$vars}) {
next unless ($key eq 'op' or
$key eq 'tool' or
$key eq 'sid' or
$key eq 'page' or
$key eq 'cid' or
$key eq 'pid' or
$key eq 'qid');
$args .= qq{
<INPUT TYPE="hidden" NAME="$key" VALUE="$vars->{$key}">};
}
my $ret;
if ($email) {
my $q_email = $S->dbh->quote($email);
my ($rv, $sth) = $S->db_select({
WHAT => 'nickname',
FROM => 'users',
WHERE => qq{realemail = $q_email OR origemail = $q_email}
});
my $user = $sth->fetchrow();
$sth->finish();
$user = 'none found' unless $user;
$ret = qq{
|norm_font|
Email: <b>$email</b><br>
User: <b>$user</b>
|norm_font_end|};
}
$ret .= qq{
<br>
<FORM ACTION="|rootdir|/" METHOD="POST">
$args
|norm_font|Lookup user by email:<br>
<small><input type="text" size="10" name="email">
<input type="submit" VALUE="Go">
|norm_font_end|
</FORM>};
return {content => $ret};
|