D:\my docs\My Received Files\Yabb\Yabb\YaBB_2.5_AEB\cgi-bin\yabb2_old\Admin\RegistrationLog.pl D:\WEBSITES\testbed\cgi-bin\yabb252\Admin\RegistrationLog.pl
############################################################################### ###############################################################################
# RegistrationLog.pl                                                          # # RegistrationLog.pl                                                          #
############################################################################### ###############################################################################
# YaBB: Yet another Bulletin Board                                            # # YaBB: Yet another Bulletin Board                                            #
# Open-Source Community Software for Webmasters                               # # Open-Source Community Software for Webmasters                               #
# Version:        YaBB 2.5 Anniversary Edition                                # # Version:        YaBB 2.5.2                                                  #
# Packaged:       July 04, 2010                                               # # Packaged:       September 30, 2012                                          #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2010 YaBB (www.yabbforum.com) - All Rights Reserved.     # # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved.     #
# Software by:  The YaBB Development Team                                     # # Software by:  The YaBB Development Team                                     #
#               with assistance from the YaBB community.                      # #               with assistance from the YaBB community.                      #
# Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com            #    
#               Your source for web hosting, web design, and domains.         #    
############################################################################### ###############################################################################
   
$registrationlogplver = 'YaBB 2.5 AE $Revision: 1.34 $'; $registrationlogplver = 'YaBB 2.5.2 $Revision: 1.1 $';
if ($action eq 'detailedversion') { return 1; } if ($action eq 'detailedversion') { return 1; }
   
&LoadLanguage('Register'); &LoadLanguage('Register');
   
sub view_reglog { sub view_reglog {
   &is_admin_or_gmod;    &is_admin_or_gmod;
   
   $yytitle = $prereg_txt{'15a'};    $yytitle = $prereg_txt{'15a'};
   
   if (-e "$vardir/registration.log") {    if (-e "$vardir/registration.log") {
       fopen(LOGFILE, "$vardir/registration.log");        fopen(LOGFILE, "$vardir/registration.log");
       @logentries = <LOGFILE>;        @logentries = <LOGFILE>;
       fclose(LOGFILE);        fclose(LOGFILE);
       @logentries = reverse @logentries;        @logentries = reverse @logentries;
   
       fopen(FILE, "$memberdir/memberlist.txt");        fopen(FILE, "$memberdir/memberlist.txt");
       @memberlist = <FILE>;        @memberlist = <FILE>;
       fclose(FILE);        fclose(FILE);
   
       # If a pre-registration list exists load it        # If a pre-registration list exists load it
       if (-e "$memberdir/memberlist.inactive") {        if (-e "$memberdir/memberlist.inactive") {
           fopen(INACT, "$memberdir/memberlist.inactive");            fopen(INACT, "$memberdir/memberlist.inactive");
           @reglist = <INACT>;            @reglist = <INACT>;
           fclose(INACT);            fclose(INACT);
       }        }
       # grab pre regged user activationkey for admin activation        # grab pre regged user activationkey for admin activation
       foreach (@reglist) {        foreach (@reglist) {
           (undef, $actcode, $regmember, undef) = split(/\|/, $_, 4);            (undef, $actcode, $regmember, undef) = split(/\|/, $_, 4);
           $actkey{$regmember} = $actcode;            $actkey{$regmember} = $actcode;
       }        }
   } else {    } else {
       $servertime = $date;        $servertime = $date;
       push(@logentries, "$servertime|LD|$username|$username|$user_ip");        push(@logentries, "$servertime|LD|$username|$username|$user_ip");
   }    }
   @memberlist = reverse @memberlist;    @memberlist = reverse @memberlist;
   
   if (@logentries > 0) {    if (@logentries > 0) {
       $logcount = @logentries;        $logcount = @logentries;
       my $newstart = $INFO{'newstart'} || 0;        my $newstart = $INFO{'newstart'} || 0;
   
       $postdisplaynum = 8;        $postdisplaynum = 8;
       $max = $logcount;        $max = $logcount;
       $newstart = (int($newstart / 25)) * 25;        $newstart = (int($newstart / 25)) * 25;
       $tmpa = 1;        $tmpa = 1;
       if ($newstart >= (($postdisplaynum - 1) * 25)) { $startpage = $newstart - (($postdisplaynum - 1) * 25); $tmpa = int( $startpage / 25 ) + 1; }        if ($newstart >= (($postdisplaynum - 1) * 25)) { $startpage = $newstart - (($postdisplaynum - 1) * 25); $tmpa = int( $startpage / 25 ) + 1; }
       if ($max >= $newstart + ($postdisplaynum * 25)) { $endpage = $newstart + ($postdisplaynum * 25); } else { $endpage = $max }        if ($max >= $newstart + ($postdisplaynum * 25)) { $endpage = $newstart + ($postdisplaynum * 25); } else { $endpage = $max }
       if ($startpage > 0) { $pageindex = qq~<a href="$adminurl?action=$action;newstart=0" style="font-weight: normal;">1</a>&nbsp;...&nbsp;~; }        if ($startpage > 0) { $pageindex = qq~<a href="$adminurl?action=$action;newstart=0" style="font-weight: normal;">1</a>&nbsp;...&nbsp;~; }
       if ($startpage == 25) { $pageindex = qq~<a href="$adminurl?action=$action;newstart=0" style="font-weight: normal;">1</a>&nbsp;~;}        if ($startpage == 25) { $pageindex = qq~<a href="$adminurl?action=$action;newstart=0" style="font-weight: normal;">1</a>&nbsp;~;}
       for ($counter = $startpage; $counter < $endpage; $counter += 25) {        for ($counter = $startpage; $counter < $endpage; $counter += 25) {
           $pageindex .= $newstart == $counter ? qq~<b>$tmpa</b>&nbsp;~ : qq~<a href="$adminurl?action=$action;newstart=$counter" style="font-weight: normal;">$tmpa</a>&nbsp;~;            $pageindex .= $newstart == $counter ? qq~<b>$tmpa</b>&nbsp;~ : qq~<a href="$adminurl?action=$action;newstart=$counter" style="font-weight: normal;">$tmpa</a>&nbsp;~;
           $tmpa++;            $tmpa++;
       }        }
       $lastpn = int($logcount / 25) + 1;        $lastpn = int($logcount / 25) + 1;
       $lastptn = ($lastpn - 1) * 25;        $lastptn = ($lastpn - 1) * 25;
       if ($endpage < $max - (25) ) { $pageindexadd = qq~...&nbsp;~; }        if ($endpage < $max - (25) ) { $pageindexadd = qq~...&nbsp;~; }
       if ($endpage != $max) { $pageindexadd .= qq~<a href="$adminurl?action=$action;newstart=$lastptn">$lastpn</a>~; }        if ($endpage != $max) { $pageindexadd .= qq~<a href="$adminurl?action=$action;newstart=$lastptn">$lastpn</a>~; }
       $pageindex .= $pageindexadd;        $pageindex .= $pageindexadd;
   
       $pageindex = qq~        $pageindex = qq~
           <tr>            <tr>
               <td class="windowbg" colspan="4"><span class="small" style="float: left;">$admin_txt{'139'}: $pageindex</span></td>                <td class="windowbg" colspan="4"><span class="small" style="float: left;">$admin_txt{'139'}: $pageindex</span></td>
           </tr>            </tr>
       ~;        ~;
   
       $numbegin = ($newstart + 1);        $numbegin = ($newstart + 1);
       $numend = ($newstart + 25);        $numend = ($newstart + 25);
       if ($numend > $logcount) { $numend  = $logcount; }        if ($numend > $logcount) { $numend  = $logcount; }
       if ($logcount == 0) { $numshow = ''; }        if ($logcount == 0) { $numshow = ''; }
       else { $numshow = qq~($numbegin - $numend)~; }        else { $numshow = qq~($numbegin - $numend)~; }
   
       @logentries = splice(@logentries, $newstart, 25);        @logentries = splice(@logentries, $newstart, 25);
   }    }
   
   foreach $logentry (@logentries) {    foreach $logentry (@logentries) {
       chomp $logentry;        chomp $logentry;
       my ($logtime, $status, $userid, $actid, $ipadd) = split(/\|/, $logentry);        my ($logtime, $status, $userid, $actid, $ipadd) = split(/\|/, $logentry);
       if($do_scramble_id){        if($do_scramble_id){
           $cryptactid = &cloak($actid);            $cryptactid = &cloak($actid);
           $cryptuserid = &cloak($userid);            $cryptuserid = &cloak($userid);
       } else {        } else {
           $cryptactid = $actid;              $cryptactid = $actid;  
           $cryptuserid = $userid;            $cryptuserid = $userid;
       }        }
       if($userid ne $actid && $actid ne '') {        if($userid ne $actid && $actid ne '') {
           &LoadUser($actid);            &LoadUser($actid);
           $actadminlink = qq~ $prereg_txt{'by'} <a href="$scripturl?action=viewprofile;username=$cryptactid">${$uid.$actid}{'realname'}</a>~;            $actadminlink = qq~ $prereg_txt{'by'} <a href="$scripturl?action=viewprofile;username=$cryptactid">${$uid.$actid}{'realname'}</a>~;
       } else {        } else {
           $actadminlink = '';            $actadminlink = '';
       }        }
       if ($status eq 'AA' && &LoadUser($userid)){        if ($status eq 'AA' && &LoadUser($userid)){
           &LoadUser($userid);            &LoadUser($userid);
           $linkuserid = qq~$userid (<a href="$scripturl?action=viewprofile;username=$cryptuserid">${$uid.$userid}{'realname'}</a>)~;              $linkuserid = qq~$userid (<a href="$scripturl?action=viewprofile;username=$cryptuserid">${$uid.$userid}{'realname'}</a>)~;  
       } else {          } else {  
           $linkuserid = $userid;              $linkuserid = $userid;  
       }        }
       $is_member = &check_member($userid);        $is_member = &check_member($userid);
       if ($do_scramble_id){ $cryptid = &cloak($userid); } else { $cryptid = $userid; }        if ($do_scramble_id){ $cryptid = &cloak($userid); } else { $cryptid = $userid; }
       $reclogtime = &timeformat($logtime);        $reclogtime = &timeformat($logtime);
       if ($status eq 'N' && $is_member == 0 && -e "$memberdir/$userid.pre") {        if ($status eq 'N' && $is_member == 0 && -e "$memberdir/$userid.pre") {
           $delrecord = qq~<a href="$adminurl?action=del_regentry;username=$cryptid">$prereg_txt{'del'}</a>~;            $delrecord = qq~<a href="$adminurl?action=del_regentry;username=$cryptid">$prereg_txt{'del'}</a>~;
           $delrecord .= qq~<br /><a href="$adminurl?action=view_regentry;username=$cryptid~ . ($actkey{$userid} ne '' ? ";activationkey=$actkey{$userid};type=validate" : "") . qq~">$prereg_txt{'view'}</a>~;            $delrecord .= qq~<br /><a href="$adminurl?action=view_regentry;username=$cryptid~ . ($actkey{$userid} ne '' ? ";activationkey=$actkey{$userid};type=validate" : "") . qq~">$prereg_txt{'view'}</a>~;
           $delrecord .= qq~<br /><a href="$scripturl?action=activate;username=$cryptid;activationkey=$actkey{$userid}">$prereg_txt{'act'}</a>~;            $delrecord .= qq~<br /><a href="$scripturl?action=activate;username=$cryptid;activationkey=$actkey{$userid}">$prereg_txt{'act'}</a>~;
       } elsif ($status eq 'W' && $is_member == 0 && -e "$memberdir/$userid.wait") {        } elsif ($status eq 'W' && $is_member == 0 && -e "$memberdir/$userid.wait") {
           $delrecord = qq~<a href="$adminurl?action=rej_regentry;username=$cryptid">$prereg_txt{'reject'}</a>~;            $delrecord = qq~<a href="$adminurl?action=rej_regentry;username=$cryptid">$prereg_txt{'reject'}</a>~;
           $delrecord .= qq~<br /><a href="$adminurl?action=view_regentry;username=$cryptid;type=approve">$prereg_txt{'view'}</a>~;            $delrecord .= qq~<br /><a href="$adminurl?action=view_regentry;username=$cryptid;type=approve">$prereg_txt{'view'}</a>~;
           $delrecord .= qq~<br /><a href="$adminurl?action=apr_regentry;username=$cryptid">$prereg_txt{'apr'}</a>~;            $delrecord .= qq~<br /><a href="$adminurl?action=apr_regentry;username=$cryptid">$prereg_txt{'apr'}</a>~;
       } else {          } else {  
           $delrecord = '---';              $delrecord = '---';  
       }        }
       $loglist .= qq~        $loglist .= qq~
       <tr>        <tr>
       <td class="windowbg" width="20%" align="center">$reclogtime</td>        <td class="windowbg" width="20%" align="center">$reclogtime</td>
       <td class="windowbg2" width="35%" align="center">$prereg_txt{$status}$actadminlink<br />IP: $ipadd</td>        <td class="windowbg2" width="35%" align="center">$prereg_txt{$status}$actadminlink<br />IP: $ipadd</td>
       <td class="windowbg" width="25%" align="center">$linkuserid</td>        <td class="windowbg" width="25%" align="center">$linkuserid</td>
       <td class="windowbg2" width="20%" align="center">$delrecord</td>        <td class="windowbg2" width="20%" align="center">$delrecord</td>
       </tr>~;        </tr>~;
   }    }
   
   $yymain .= qq~    $yymain .= qq~
   <script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script>    <script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script>
   <form name="reglog_form" action="$adminurl?action=clean_reglog" method="post" onsubmit="return submitproc();">    <form name="reglog_form" action="$adminurl?action=clean_reglog" method="post" onsubmit="return submitproc();">
<div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;">
   <table width="100%" cellspacing="1" cellpadding="4">    <table width="100%" cellspacing="1" cellpadding="4">
   <tr valign="middle">    <tr valign="middle">
       <td align="left" class="titlebg" colspan="4"><img src="$imagesdir/xx.gif" alt="" border="0" /> <b>$yytitle</b></td>        <td align="left" class="titlebg" colspan="4"><img src="$imagesdir/xx.gif" alt="" border="0" /> <b>$yytitle</b></td>
   </tr>    </tr>
   <tr valign="middle">    <tr valign="middle">
       <td align="left" class="windowbg2" colspan="4"><br />$prereg_txt{'20'}<br /><br /></td>        <td align="left" class="windowbg2" colspan="4"><br />$prereg_txt{'20'}<br /><br /></td>
   </tr>    </tr>
   $pageindex    $pageindex
   <tr valign="middle">    <tr valign="middle">
       <td align="center" class="catbg" width="20%"><b>$prereg_txt{'17'}</b></td>        <td align="center" class="catbg" width="20%"><b>$prereg_txt{'17'}</b></td>
       <td align="center" class="catbg" width="35%"><b>$prereg_txt{'18'}</b></td>        <td align="center" class="catbg" width="35%"><b>$prereg_txt{'18'}</b></td>
       <td align="center" class="catbg" width="25%"><b>$prereg_txt{'19'}</b></td>        <td align="center" class="catbg" width="25%"><b>$prereg_txt{'19'}</b></td>
       <td align="center" class="catbg" width="20%"><b>$prereg_txt{'action'}</b></td>        <td align="center" class="catbg" width="20%"><b>$prereg_txt{'action'}</b></td>
   </tr>    </tr>
   $loglist    $loglist
   </table>    </table>
</div> </div>
   
<br /> <br />
<div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;">
  <table width="100%" cellspacing="1" cellpadding="4">   <table width="100%" cellspacing="1" cellpadding="4">
    <tr valign="middle">     <tr valign="middle">
      <td align="center" class="catbg">       <td align="center" class="catbg">
        <input type="submit" value="$prereg_txt{'9'}" onclick="return confirm('$prereg_txt{'9'}');" class="button" />         <input type="submit" value="$prereg_txt{'9'}" onclick="return confirm('$prereg_txt{'9'}');" class="button" />
      </td>       </td>
    </tr>     </tr>
  </table>   </table>
</div> </div>
   
</form> </form>
~; ~;
   $action_area = 'view_reglog';    $action_area = 'view_reglog';
   &AdminTemplate;    &AdminTemplate;
} }
   
sub check_member { sub check_member {
   my $is_member = 0;    my $is_member = 0;
   foreach $lstmember (@memberlist) {    foreach $lstmember (@memberlist) {
       chomp $lstmember;        chomp $lstmember;
       ($listmember, undef) = split(/\t/, $lstmember, 2);        ($listmember, undef) = split(/\t/, $lstmember, 2);
       if ($_[0] eq $listmember) {        if ($_[0] eq $listmember) {
           $is_member = 1;            $is_member = 1;
           last;            last;
       }        }
   }    }
   $is_member;    $is_member;
} }
   
sub clean_reglog { sub clean_reglog {
   &is_admin_or_gmod;    &is_admin_or_gmod;
   my (@outlist, @reglist, $reguser, $regstatus);    my (@outlist, @reglist, $reguser, $regstatus);
   fopen(REG, "$vardir/registration.log", 1);    fopen(REG, "$vardir/registration.log", 1);
   @reglist = <REG>;    @reglist = <REG>;
   fclose(REG);    fclose(REG);
   ## depending on registration type only leave uncompleted entries in the log for completion and remove the failed or completed ones ##    ## depending on registration type only leave uncompleted entries in the log for completion and remove the failed or completed ones ##
   foreach (@reglist) {    foreach (@reglist) {
       (undef, $regstatus, $reguser, undef) = split(/\|/, $_);        (undef, $regstatus, $reguser, undef) = split(/\|/, $_);
       if (($regtype == 1 || $regtype == 2) && $regstatus eq "N" && -e "$memberdir/$reguser.pre") {        if (($regtype == 1 || $regtype == 2) && $regstatus eq "N" && -e "$memberdir/$reguser.pre") {
           push(@outlist, $_);            push(@outlist, $_);
       }        }
       if ($regtype == 1 && $regstatus eq "W" && -e "$memberdir/$reguser.wait") {        if ($regtype == 1 && $regstatus eq "W" && -e "$memberdir/$reguser.wait") {
           push(@outlist, $_);            push(@outlist, $_);
       }        }
   }    }
   fopen(REG, ">$vardir/registration.log", 1);    fopen(REG, ">$vardir/registration.log", 1);
   print REG @outlist;    print REG @outlist;
   fclose(REG);    fclose(REG);
   
   $yySetLocation = qq~$adminurl?action=view_reglog~;    $yySetLocation = qq~$adminurl?action=view_reglog~;
   &redirectexit;    &redirectexit;
} }
   
sub kill_registration { sub kill_registration {
   &is_admin_or_gmod;    &is_admin_or_gmod;
   my $changed;    my $changed;
   my $deluser = $_[0] || $INFO{'username'};    my $deluser = $_[0] || $INFO{'username'};
   if ($do_scramble_id) { $deluser = &decloak($deluser); }    if ($do_scramble_id) { $deluser = &decloak($deluser); }
   
   fopen(INFILE, "$memberdir/memberlist.inactive");    fopen(INFILE, "$memberdir/memberlist.inactive");
   @actlist = <INFILE>;    @actlist = <INFILE>;
   fclose(INFILE);    fclose(INFILE);
   
   # check if user is in pre-registration and check activation key    # check if user is in pre-registration and check activation key
   foreach (@actlist) {    foreach (@actlist) {
       ($regtime, undef, $regmember, undef) = split(/\|/, $_, 4);        ($regtime, undef, $regmember, undef) = split(/\|/, $_, 4);
       if ($deluser eq $regmember) {        if ($deluser eq $regmember) {
           $changed = 1;            $changed = 1;
           unlink "$memberdir/$regmember.pre";            unlink "$memberdir/$regmember.pre";
   
           # add entry to registration log            # add entry to registration log
           fopen(REG, ">>$vardir/registration.log", 1);            fopen(REG, ">>$vardir/registration.log", 1);
           print REG "$date|D|$regmember|$username|$user_ip\n";            print REG "$date|D|$regmember|$username|$user_ip\n";
           fclose(REG);            fclose(REG);
       } else {        } else {
           # update non activate user list            # update non activate user list
           # write valid registration to the list again            # write valid registration to the list again
           push(@outlist, $_);            push(@outlist, $_);
       }        }
   }    }
   if ($changed) {    if ($changed) {
       # re-open inactive list for update if changed        # re-open inactive list for update if changed
       fopen(OUTFILE, ">$memberdir/memberlist.inactive", 1);        fopen(OUTFILE, ">$memberdir/memberlist.inactive", 1);
       print OUTFILE @outlist;        print OUTFILE @outlist;
       fclose(OUTFILE);        fclose(OUTFILE);
   }    }
   $yySetLocation = qq~$adminurl?action=view_reglog~;    $yySetLocation = qq~$adminurl?action=view_reglog~;
   &redirectexit;    &redirectexit;
} }
   
sub view_registration { sub view_registration {
   &is_admin_or_gmod;    &is_admin_or_gmod;
   my $viewuser = $INFO{'username'} || $FORM{'username'};    my $viewuser = $INFO{'username'} || $FORM{'username'};
   my $readuser = $viewuser;    my $readuser = $viewuser;
   my $viewtype = $INFO{'type'};    my $viewtype = $INFO{'type'};
   my $actkey = $INFO{'activationkey'};    my $actkey = $INFO{'activationkey'};
   if ($do_scramble_id) { $readuser = &decloak($viewuser); }    if ($do_scramble_id) { $readuser = &decloak($viewuser); }
   &LoadUser($readuser);    &LoadUser($readuser);
   $yymain .= qq~    $yymain .= qq~
<form action="$adminurl?action=admin_descision;activationkey=$actkey" method="post" name="creator"> <form action="$adminurl?action=admin_descision;activationkey=$actkey" method="post" name="creator">
<input type="hidden" name="username" value="$viewuser" /> <input type="hidden" name="username" value="$viewuser" />
<table cellspacing="1" cellpadding="4" width="100%" align="center" class="bordercolor" border="0"> <table cellspacing="1" cellpadding="4" width="100%" align="center" class="bordercolor" border="0">
<tr> <tr>
  <td colspan="2" class="catbg"><img src="$imagesdir/profile.gif" alt="" border="0" /> <b>$prereg_txt{'view'}</b>   <td colspan="2" class="catbg"><img src="$imagesdir/profile.gif" alt="" border="0" /> <b>$prereg_txt{'view'}</b>
   <input type="hidden" name="type" value="$viewtype" />    <input type="hidden" name="type" value="$viewtype" />
   <input type="hidden" name="activationkey" value="$actkey" />    <input type="hidden" name="activationkey" value="$actkey" />
 </td>  </td>
</tr><tr class="windowbg"> </tr><tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_id'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_id'}: </b></td>
  <td align="left">$readuser</td>   <td align="left">$readuser</td>
</tr><tr class="windowbg"> </tr><tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_name'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_name'}: </b></td>
  <td align="left">${$uid.$readuser}{'realname'}</td>   <td align="left">${$uid.$readuser}{'realname'}</td>
</tr>~; </tr>~;
   
   if ($viewtype eq "validate"){    if ($viewtype eq "validate"){
       $yymain .= qq~<tr class="windowbg">        $yymain .= qq~<tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_email_invalid'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_email_invalid'}: </b></td>
  <td align="left">${$uid.$readuser}{'email'}</td>   <td align="left">${$uid.$readuser}{'email'}</td>
</tr>~; </tr>~;
   } elsif ($viewtype eq "approve"){    } elsif ($viewtype eq "approve"){
       $yymain .= qq~<tr class="windowbg">        $yymain .= qq~<tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_email_valid'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_email_valid'}: </b></td>
  <td align="left">${$uid.$readuser}{'email'}</td>   <td align="left">${$uid.$readuser}{'email'}</td>
</tr>~; </tr>~;
   }    }
   
   if ($addmemgroup_enabled == 2 || $addmemgroup_enabled == 3) {    if ($addmemgroup_enabled == 2 || $addmemgroup_enabled == 3) {
       my @usergroup;        my @usergroup;
       foreach (split(/,/, ${$uid.$readuser}{'addgroups'})) {        foreach (split(/,/, ${$uid.$readuser}{'addgroups'})) {
           push(@usergroup, (split(/\|/, $NoPost{${$uid.$readuser}{'addgroups'}}, 2))[0]);            push(@usergroup, (split(/\|/, $NoPost{${$uid.$readuser}{'addgroups'}}, 2))[0]);
       }        }
       $yymain .= qq~<tr class="windowbg">        $yymain .= qq~<tr class="windowbg">
  <td width="320" align="left"><b>$register_txt{'765'}:</b></td>   <td width="320" align="left"><b>$register_txt{'765'}:</b></td>
  <td align="left">~ . join(', ', @usergroup) . qq~</td>   <td align="left">~ . join(', ', @usergroup) . qq~</td>
</tr>~; </tr>~;
   }    }
   
   $yymain .= qq~<tr class="windowbg">    $yymain .= qq~<tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_language'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_language'}: </b></td>
  <td align="left">${$uid.$readuser}{'language'}</td>   <td align="left">${$uid.$readuser}{'language'}</td>
</tr><tr class="windowbg"> </tr><tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_ip'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_ip'}: </b></td>
  <td align="left">${$uid.$readuser}{'lastips'}</td>   <td align="left">${$uid.$readuser}{'lastips'}</td>
</tr>~; </tr>~;
   
   if ($regtype == 1){    if ($regtype == 1){
       $yymain .= qq~<tr class="windowbg">        $yymain .= qq~<tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_reason'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_reason'}: </b></td>
  <td align="left">${$uid.$readuser}{'regreason'}</td>   <td align="left">${$uid.$readuser}{'regreason'}</td>
</tr>~; </tr>~;
   }    }
     if ($extendedprofiles) {  
         require "$sourcedir/ExtendedProfiles.pl";  
         $yymain .= &ext_viewprofile_r($readuser);  
     }  
   
   if ($viewtype eq "approve"){    if ($viewtype eq "approve"){
       $yymain .= qq~<tr>        $yymain .= qq~<tr>
  <td colspan="2" class="catbg"><img src="$imagesdir/profile.gif" alt="" border="0" /> <b>$prereg_txt{'apr_admin_reason_title'}</b></td>   <td colspan="2" class="catbg"><img src="$imagesdir/profile.gif" alt="" border="0" /> <b>$prereg_txt{'apr_admin_reason_title'}</b></td>
</tr> </tr>
<tr class="windowbg"> <tr class="windowbg">
  <td width="320" align="left"><b>$prereg_txt{'apr_admin_reason'}: </b></td>   <td width="320" align="left"><b>$prereg_txt{'apr_admin_reason'}: </b></td>
  <td align="left"><textarea rows="4" cols="50" id="admin_reason" name="admin_reason">$admin_reason</textarea></td>   <td align="left"><textarea rows="4" cols="50" id="admin_reason" name="admin_reason">$admin_reason</textarea></td>
</tr> </tr>
<tr class="catbg"> <tr class="catbg">
   <td height="30" valign="middle" align="center" colspan="2">    <td height="30" valign="middle" align="center" colspan="2">
   <input type="submit" name="moda" value="$prereg_txt{'apr_admin_reject'}" onclick="return confirm('$prereg_txt{'apr_admin_reject'} ?')" class="button" />    <input type="submit" name="moda" value="$prereg_txt{'apr_admin_reject'}" onclick="return confirm('$prereg_txt{'apr_admin_reject'} ?')" class="button" />
   <input type="submit" name="moda" value="$prereg_txt{'apr_admin_approve'}" onclick="return confirm('$prereg_txt{'apr_admin_approve'} ?')" class="button" />    <input type="submit" name="moda" value="$prereg_txt{'apr_admin_approve'}" onclick="return confirm('$prereg_txt{'apr_admin_approve'} ?')" class="button" />
   </td>    </td>
</tr>~; </tr>~;
   
   } elsif ($viewtype eq "validate"){    } elsif ($viewtype eq "validate"){
       $yymain .= qq~<tr class="catbg">        $yymain .= qq~<tr class="catbg">
   <td height="30" valign="middle" align="center" colspan="2">    <td height="30" valign="middle" align="center" colspan="2">
   <input type="submit" name="moda" value="$prereg_txt{'apr_admin_delete'}" onclick="return confirm('$prereg_txt{'apr_admin_delete'} ?')" class="button" />    <input type="submit" name="moda" value="$prereg_txt{'apr_admin_delete'}" onclick="return confirm('$prereg_txt{'apr_admin_delete'} ?')" class="button" />
   <input type="submit" name="moda" value="$prereg_txt{'apr_admin_validate'}" onclick="return confirm('$prereg_txt{'apr_admin_validate'} ?')" class="button" />    <input type="submit" name="moda" value="$prereg_txt{'apr_admin_validate'}" onclick="return confirm('$prereg_txt{'apr_admin_validate'} ?')" class="button" />
   </td>    </td>
</tr>~; </tr>~;
   }    }
   
   $yymain .= qq~    $yymain .= qq~
</table> </table>
</form>~; </form>~;
   
   $yytitle = "$prereg_txt{'view'}";    $yytitle = "$prereg_txt{'view'}";
   &AdminTemplate;    &AdminTemplate;
} }
   
sub process_registration_review { sub process_registration_review {
   &is_admin_or_gmod;    &is_admin_or_gmod;
   my $descuser  = $FORM{'username'};    my $descuser  = $FORM{'username'};
   my $desctype  = $FORM{'type'};    my $desctype  = $FORM{'type'};
   my $descision = $FORM{'moda'};    my $descision = $FORM{'moda'};
   my $actkey    = $FORM{'activationkey'};    my $actkey    = $FORM{'activationkey'};
   $admin_reason = $FORM{'admin_reason'};    $admin_reason = $FORM{'admin_reason'};
   if ($desctype eq "validate") {    if ($desctype eq "validate") {
       if ($descision eq $prereg_txt{'apr_admin_validate'}) {        if ($descision eq $prereg_txt{'apr_admin_validate'}) {
           require "$sourcedir/Register.pl";            require "$sourcedir/Register.pl";
           &user_activation($descuser,$actkey);            &user_activation($descuser,$actkey);
       } elsif ($descision eq $prereg_txt{'apr_admin_delete'}) {        } elsif ($descision eq $prereg_txt{'apr_admin_delete'}) {
           &kill_registration($descuser);            &kill_registration($descuser);
       }        }
   } elsif ($desctype eq "approve") {    } elsif ($desctype eq "approve") {
       if ($descision eq $prereg_txt{'apr_admin_approve'}) {        if ($descision eq $prereg_txt{'apr_admin_approve'}) {
           &approve_registration($descuser);            &approve_registration($descuser);
       } elsif ($descision eq $prereg_txt{'apr_admin_reject'}) {        } elsif ($descision eq $prereg_txt{'apr_admin_reject'}) {
           &reject_registration($descuser);            &reject_registration($descuser);
       }        }
   }    }
} }
   
sub reject_registration { sub reject_registration {
   &is_admin_or_gmod;    &is_admin_or_gmod;
   my $deluser = $_[0] || $INFO{'username'};    my $deluser = $_[0] || $INFO{'username'};
   if (!$admin_reason) { $admin_reason = $FORM{'admin_reason'}; }    if (!$admin_reason) { $admin_reason = $FORM{'admin_reason'}; }
   if ($do_scramble_id) { $deluser = &decloak($deluser); }    if ($do_scramble_id) { $deluser = &decloak($deluser); }
   
   if (-e "$memberdir/memberlist.approve" && $regtype == 1) {    if (-e "$memberdir/memberlist.approve" && $regtype == 1) {
       fopen(APR, "$memberdir/memberlist.approve");        fopen(APR, "$memberdir/memberlist.approve");
       @aprlist = <APR>;        @aprlist = <APR>;
       fclose(APR);        fclose(APR);
   }    }
   # check if waiting user exists    # check if waiting user exists
   if (-e "$memberdir/$deluser.wait") {    if ( -e "$memberdir/$deluser.wait" ) {
       &LoadUser($deluser);         LoadUser($deluser); 
       ## send a rejection email ##        ## send a rejection email ##
       my $templanguage = $language;        my $templanguage = $language;
       $language = ${$uid.$deluser}{'language'};         $language = ${ $uid . $deluser }{'language'}; 
       &LoadLanguage('Email');         LoadLanguage('Email'); 
       require "$sourcedir/Mailer.pl";        require "$sourcedir/Mailer.pl";
       if ($admin_reason ne "") {        if ( $admin_reason ne q{} ) {
           $message = &template_email($reviewrejectedemail, {'displayname' => ${$uid.$deluser}{'realname'}, 'username' => $deluser, 'reviewer' => ${$uid.$username}{'realname'}, 'reason' => $admin_reason });             $message = template_email( 
       } else {                 $reviewrejectedemail, 
           $message = &template_email($instantrejectedemail, {'displayname' => ${$uid.$deluser}{'realname'}, 'username' => $deluser, 'reviewer' => ${$uid.$username}{'realname'}});                 { 
       }                     'displayname' => ${ $uid . $deluser }{'realname'}, 
       &sendmail(${$uid.$deluser}{'email'}, "$mailreg_txt{'apr_result_reject'} $mbname", $message,'',$emailcharset);                     'username'    => $deluser, 
                     'reviewer'    => ${ $uid . $username }{'realname'},  
                     'reason'      => $admin_reason  
                 }  
             );  
         sendmail(  
             ${ $uid . $deluser }{'email'},  
             "$mailreg_txt{'apr_result_reject'} $mbname",  
             $message, q{}, $emailcharset  
         );  
         }  
         elsif ( $nomailspammer == 1 ) {  
             $message = template_email(  
                 $instantrejectedemail,  
                 {  
                     'displayname' => ${ $uid . $deluser }{'realname'},  
                     'username'    => $deluser,  
                     'reviewer'    => ${ $uid . $username }{'realname'}  
                 }  
             );  
   
             sendmail(  
                 ${ $uid . $deluser }{'email'},  
                 "$mailreg_txt{'apr_result_reject'} $mbname",  
                 $message, q{}, $emailcharset  
             );  
         }  
       $language = $templanguage;        $language = $templanguage;
   
       ## remove the registration data for the rejected user ##        ## remove the registration data for the rejected user ##
       unlink "$memberdir/$deluser.wait";        unlink "$memberdir/$deluser.wait";
       foreach (@aprlist) {        foreach (@aprlist) {
           (undef, undef, $regmember, undef) = split(/\|/, $_, 4);            (undef, undef, $regmember, undef) = split(/\|/, $_, 4);
           if ($regmember ne $deluser) {            if ($regmember ne $deluser) {
               push(@aprchnglist, $_);                push(@aprchnglist, $_);
           }            }
       }        }
       # update approval user list        # update approval user list
       fopen(APR, ">$memberdir/memberlist.approve");        fopen(APR, ">$memberdir/memberlist.approve");
       print APR @aprchnglist;        print APR @aprchnglist;
       fclose(APR);        fclose(APR);
   
       ## add entry to registration log ##        ## add entry to registration log ##
       fopen(REG, ">>$vardir/registration.log", 1);        fopen(REG, ">>$vardir/registration.log", 1);
       print REG "$date|AR|$deluser|$username|$user_ip\n";        print REG "$date|AR|$deluser|$username|$user_ip\n";
       fclose(REG);        fclose(REG);
   }    }
   $yySetLocation = qq~$adminurl?action=view_reglog~;    $yySetLocation = qq~$adminurl?action=view_reglog~;
   &redirectexit;    &redirectexit;
} }
   
sub approve_registration { sub approve_registration {
   &is_admin_or_gmod;    &is_admin_or_gmod;
   my $apruser = $_[0] || $INFO{'username'};    my $apruser = $_[0] || $INFO{'username'};
   if (!$admin_reason) { $admin_reason = $FORM{'admin_reason'}; }    if (!$admin_reason) { $admin_reason = $FORM{'admin_reason'}; }
   if ($do_scramble_id) { $apruser = &decloak($apruser); }    if ($do_scramble_id) { $apruser = &decloak($apruser); }
   
   ## load the list with waiting approvals ##    ## load the list with waiting approvals ##
   fopen(APR, "$memberdir/memberlist.approve");    fopen(APR, "$memberdir/memberlist.approve");
   @aprlist = <APR>;    @aprlist = <APR>;
   fclose(APR);    fclose(APR);
   
   foreach (@aprlist) {    foreach (@aprlist) {
       (undef, undef, $regmember, $regpassword) = split(/\|/, $_);        (undef, undef, $regmember, $regpassword) = split(/\|/, $_);
       if ($regmember ne $apruser) {        if ($regmember ne $apruser) {
           push(@aprchnglist, $_);            push(@aprchnglist, $_);
       } else {        } else {
           $foundmember = $regmember;            $foundmember = $regmember;
           $foundpassword = $regpassword;            $foundpassword = $regpassword;
       }        }
   }    }
   
   ## check if waiting user exists and was indeed in the waiting list ##    ## check if waiting user exists and was indeed in the waiting list ##
   if (-e "$memberdir/$apruser.wait" && $foundmember ne "") {    if (-e "$memberdir/$apruser.wait" && $foundmember ne "") {
       &LoadUser($apruser);        &LoadUser($apruser);
       # ckeck if email is allready in active use        # ckeck if email is allready in active use
       if (lc ${$uid.$apruser}{'email'} eq lc &MemberIndex("check_exist", ${$uid.$apruser}{'email'})) {        if (lc ${$uid.$apruser}{'email'} eq lc &MemberIndex("check_exist", ${$uid.$apruser}{'email'})) {
           $yymain .= qq~<font color="red"><b>$prereg_txt{'email_taken'} <i>${$uid.$apruser}{'email'}</i> ($prereg_txt{'35'}: $apruser)</b></font>~;            $yymain .= qq~<font color="red"><b>$prereg_txt{'email_taken'} <i>${$uid.$apruser}{'email'}</i> ($prereg_txt{'35'}: $apruser)</b></font>~;
           &view_reglog;            &view_reglog;
       }        }
   
       ## user is approved, so let him/her in ##        ## user is approved, so let him/her in ##
       rename("$memberdir/$apruser.wait", "$memberdir/$apruser.vars");        rename("$memberdir/$apruser.wait", "$memberdir/$apruser.vars");
       &MemberIndex("add", $apruser);        &MemberIndex("add", $apruser);
   
       ## send a approval email ##        ## send a approval email ##
       my $templanguage = $language;        my $templanguage = $language;
       $language = ${$uid.$apruser}{'language'};        $language = ${$uid.$apruser}{'language'};
       &LoadLanguage('Email');        &LoadLanguage('Email');
       require "$sourcedir/Mailer.pl";        require "$sourcedir/Mailer.pl";
       if ($emailpassword) {        if ($emailpassword) {
           if ($admin_reason ne "") {            if ($admin_reason ne "") {
               $message = &template_email($pwreviewapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}, 'reason' => $admin_reason, 'password' => $foundpassword });                $message = &template_email($pwreviewapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}, 'reason' => $admin_reason, 'password' => $foundpassword });
           } else {            } else {
               $message = &template_email($pwinstantapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}, 'password' => $foundpassword});                $message = &template_email($pwinstantapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}, 'password' => $foundpassword});
           }            }
       } else {        } else {
           if ($admin_reason ne "") {            if ($admin_reason ne "") {
               $message = &template_email($reviewapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}, 'reason' => $admin_reason });                $message = &template_email($reviewapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}, 'reason' => $admin_reason });
           } else {            } else {
               $message = &template_email($instantapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}});                $message = &template_email($instantapprovedemail, {'displayname' => ${$uid.$apruser}{'realname'}, 'username' => $apruser, 'reviewer' => ${$uid.$username}{'realname'}});
           }            }
       }        }
       &sendmail(${$uid.$apruser}{'email'}, "$mailreg_txt{'apr_result_approved'} $mbname", $message,'',$emailcharset);        &sendmail(${$uid.$apruser}{'email'}, "$mailreg_txt{'apr_result_approved'} $mbname", $message,'',$emailcharset);
       $language = $templanguage;        $language = $templanguage;
   
       if ($send_welcomeim == 1) {        if ($send_welcomeim == 1) {
           # new format msg file:            # new format msg file:
           # messageid|(from)user|(touser(s))|(ccuser(s))|(bccuser(s))|subject|date|message|(parentmid)|reply#|ip|messagestatus|flags|storefolder|attachment            # messageid|(from)user|(touser(s))|(ccuser(s))|(bccuser(s))|subject|date|message|(parentmid)|reply#|ip|messagestatus|flags|storefolder|attachment
           $messageid = $^T . $$;            $messageid = $^T . $$;
           fopen(INBOX, ">$memberdir/$apruser.msg");            fopen(INBOX, ">$memberdir/$apruser.msg");
           print INBOX "$messageid|$sendname|$apruser|||$imsubject|$date|$imtext|$messageid|0|$ENV{'REMOTE_ADDR'}|s|u||\n";            print INBOX "$messageid|$sendname|$apruser|||$imsubject|$date|$imtext|$messageid|0|$ENV{'REMOTE_ADDR'}|s|u||\n";
           fclose(INBOX);            fclose(INBOX);
       }        }
   
       # update approval user list        # update approval user list
       fopen(APR, ">$memberdir/memberlist.approve");        fopen(APR, ">$memberdir/memberlist.approve");
       print APR @aprchnglist;        print APR @aprchnglist;
       fclose(APR);        fclose(APR);
   
       ## add entry to registration log ##        ## add entry to registration log ##
       fopen(REG, ">>$vardir/registration.log", 1);        fopen(REG, ">>$vardir/registration.log", 1);
       print REG "$date|AA|$apruser|$username|$user_ip\n";        print REG "$date|AA|$apruser|$username|$user_ip\n";
       fclose(REG);        fclose(REG);
   }    }
   $yySetLocation = qq~$adminurl?action=view_reglog~;    $yySetLocation = qq~$adminurl?action=view_reglog~;
   &redirectexit;    &redirectexit;
} }
   
   
1; 1;