D:\WEBSITES\testbed\zipped\yabb252_09_15\cgi-bin\yabb2\Sources\Register.pl D:\WEBSITES\testbed\cgi-bin\yabb252\Sources\Register.pl
############################################################################### ###############################################################################
# Register.pl                                                                 # # Register.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.2                                                  # # Version:        YaBB 2.5.2                                                  #
# Packaged:       September 30, 2012                                          # # Packaged:       September 30, 2012                                          #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2012 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.                      #
############################################################################### ###############################################################################
   
$registerplver = 'YaBB 2.5.2 $Revision: 1.3 $'; $registerplver = 'YaBB 2.5.2 $Revision: 1.4 $';
if ($action eq 'detailedversion') { return 1; } if ($action eq 'detailedversion') { return 1; }
if (!$iamguest && (!$admin && $action ne 'activate' && $action ne 'admin_descision') ) { &fatal_error("no_registration_logged_in"); } if (!$iamguest && (!$admin && $action ne 'activate' && $action ne 'admin_descision') ) { &fatal_error("no_registration_logged_in"); }
   
require "$sourcedir/Mailer.pl"; require "$sourcedir/Mailer.pl";
&LoadLanguage('Register'); &LoadLanguage('Register');
&LoadCensorList; &LoadCensorList;
   
if ($^O =~ /Win/) { if ($^O =~ /Win/) {
   my $regstyle = qq~ style="text-transform: lowercase"~;    my $regstyle = qq~ style="text-transform: lowercase"~;
} else { } else {
   my $regstyle = '';    my $regstyle = '';
} }
   
$hony = int rand 4;    
$newfieldb = $honeypot{$hony};    
sub Register { sub Register {
   if ($regtype == 0 && $iamguest) { &fatal_error("registration_disabled"); }    if ($regtype == 0 && $iamguest) { &fatal_error("registration_disabled"); }
   my ($tmpregname, $tmprealname, $tmpregemail, $tmpregpasswrd1, $tmpregpasswrd2, $hidechecked, @birthdate);    my ($tmpregname, $tmprealname, $tmpregemail, $tmpregpasswrd1, $tmpregpasswrd2, $hidechecked, @birthdate);
   $yytitle = $register_txt{'97'};    $yytitle = $register_txt{'97'};
   $yynavigation = qq~› $register_txt{'97'}~;    $yynavigation = qq~› $register_txt{'97'}~;
   if ($FORM{'reglanguage'}) {    if ($FORM{'reglanguage'}) {
       $language = $FORM{'reglanguage'};        $language = $FORM{'reglanguage'};
       &LoadLanguage('Register');        &LoadLanguage('Register');
   }    }
   if ($FORM{'regusername'}) { $tmpregname     = $FORM{'regusername'}; }    if ($FORM{'regusername'}) { $tmpregname     = $FORM{'regusername'}; }
   if ($FORM{'regrealname'}) { $tmprealname    = $FORM{'regrealname'}; }    if ($FORM{'regrealname'}) { $tmprealname    = $FORM{'regrealname'}; }
   if ($FORM{'email'})       { $tmpregemail    = $FORM{'email'}; }    if ($FORM{'email'})       { $tmpregemail    = $FORM{'email'}; }
   if ($FORM{'hideemail'} || !exists $FORM{'hideemail'}) { $hidechecked = qq~ checked="checked"~; }    if ($FORM{'hideemail'} || !exists $FORM{'hideemail'}) { $hidechecked = qq~ checked="checked"~; }
   if ($FORM{'add_field0'})    { $newfield       = $FORM{'add_field0'}; }    if ($FORM{'add_field0'})    { $newfield       = $FORM{'add_field0'}; }
   if ($FORM{'passwrd1'})    { $tmpregpasswrd1 = $FORM{'passwrd1'}; }    if ($FORM{'passwrd1'})    { $tmpregpasswrd1 = $FORM{'passwrd1'}; }
   if ($FORM{'passwrd2'})    { $tmpregpasswrd2 = $FORM{'passwrd2'}; }    if ($FORM{'passwrd2'})    { $tmpregpasswrd2 = $FORM{'passwrd2'}; }
   if ($FORM{'reason'})      { $reason         = $FORM{'reason'}; }    if ($FORM{'reason'})      { $reason         = $FORM{'reason'}; }
   if ($FORM{'birth_day'})   { $birthdate[0]   = $FORM{'birth_day'}; }    if ($FORM{'birth_day'})   { $birthdate[0]   = $FORM{'birth_day'}; }
   if ($FORM{'birth_month'}) { $birthdate[1]   = $FORM{'birth_month'}; }    if ($FORM{'birth_month'}) { $birthdate[1]   = $FORM{'birth_month'}; }
   if ($FORM{'birth_year'})  { $birthdate[2]   = $FORM{'birth_year'}; }    if ($FORM{'birth_year'})  { $birthdate[2]   = $FORM{'birth_year'}; }
   
   ## moved langopt setup to subs.pl    ## moved langopt setup to subs.pl
   if (!$langopt) { &guestLangSel; }    if (!$langopt) { &guestLangSel; }
   
   if (-e "$vardir/email_domain_filter.txt" ) { require "$vardir/email_domain_filter.txt"; }    if (-e "$vardir/email_domain_filter.txt" ) { require "$vardir/email_domain_filter.txt"; }
   if ($adomains) {    if ($adomains) {
       @domains = split (/\,/, $adomains);        @domains = split (/\,/, $adomains);
       $aedomains = qq~<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td><input type="text" maxlength="100" name="email" id="email" value="$tmpregemail" size="15" /></td><td><select name="domain" id="domain">~;        $aedomains = qq~<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td><input type="text" maxlength="100" name="email" id="email" value="$tmpregemail" size="15" /></td><td><select name="domain" id="domain">~;
       foreach (@domains) { $aedomains .= ($_ =~ m/\@/) ? qq~<option value="$_">$_</option>~ : qq~<option value="\@$_">&#64;$_</option>~; }        foreach (@domains) { $aedomains .= ($_ =~ m/\@/) ? qq~<option value="$_">$_</option>~ : qq~<option value="\@$_">&#64;$_</option>~; }
       $aedomains .= qq~</select></td></tr></table>~;        $aedomains .= qq~</select></td></tr></table>~;
   
   } else {    } else {
       $aedomains .= qq~<input type="text" maxlength="100" onchange="checkAvail('$scripturl',this.value,'email')" name="email" id="email" value="$tmpregemail" size="45" />~;        $aedomains .= qq~<input type="text" maxlength="100" onchange="checkAvail('$scripturl',this.value,'email')" name="email" id="email" value="$tmpregemail" size="45" />~;
   }    }
   
   $yymain .= qq~    $yymain .= qq~
<script language="JavaScript1.2" type="text/javascript" src="$yyhtml_root/ajax.js"></script> <script language="JavaScript1.2" type="text/javascript" src="$yyhtml_root/ajax.js"></script>
<form action="$scripturl?action=register2" method="post" name="creator" onsubmit="return CheckRegFields();"> <form action="$scripturl?action=register2" method="post" name="creator" onsubmit="return CheckRegFields();">
<table border="0" width="100%" cellpadding="4" cellspacing="1" class="bordercolor"> <table border="0" width="100%" cellpadding="4" cellspacing="1" class="bordercolor">
   <colgroup>    <colgroup>
       <col width="45%" />        <col width="45%" />
       <col width="55%" />        <col width="55%" />
   </colgroup>    </colgroup>
   <tr>    <tr>
       <td colspan="2" class="titlebg">        <td colspan="2" class="titlebg">
           <img src="$imagesdir/register.gif" alt="$register_txt{'97'}" title="$register_txt{'97'}" border="0" />            <img src="$imagesdir/register.gif" alt="$register_txt{'97'}" title="$register_txt{'97'}" border="0" />
           <span class="text1"><b>$register_txt{'97'}</b> $register_txt{'517'}</span>            <span class="text1"><b>$register_txt{'97'}</b> $register_txt{'517'}</span>
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg" colspan="2" align="center">        <td class="windowbg" colspan="2" align="center">
           $register_txt{'97a'}            $register_txt{'97a'}
       </td>        </td>
   </tr>~;    </tr>~;
   
   if ($morelang > 1) {    if ($morelang > 1) {
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="reglanguage"><b>$register_txt{'101'}</b></label>            <label for="reglanguage"><b>$register_txt{'101'}</b></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <select name="reglanguage" id="reglanguage" onchange="document.creator.action='$scripturl?action=register'; document.creator.submit();">            <select name="reglanguage" id="reglanguage" onchange="document.creator.action='$scripturl?action=register'; document.creator.submit();">
           $langopt            $langopt
           </select>            </select>
           <noscript><input type="submit" value="$maintxt{'32'}" class="button" /></noscript>            <noscript><input type="submit" value="$maintxt{'32'}" class="button" /></noscript>
       </td>        </td>
   </tr>~;    </tr>~;
   }    }
     $newfield = q{};      $newfield = q{};
   $yymain .= qq~    $yymain .= qq~
<!--user name section--> <!--user name section-->
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="regusername"><b>$register_txt{'98'}:</b><br />            <label for="regusername"><b>$register_txt{'98'}:</b><br />
           <span class="small">$register_txt{'520'}$register_txt{'241ea'}</span></label>            <span class="small">$register_txt{'520'}$register_txt{'241ea'}</span></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <input type="text" name="regusername" id="regusername" onchange="checkAvail('$scripturl',this.value,'user')" size="30" value="$tmpregname" maxlength="18"$regstyle /> *            <input type="text" name="regusername" id="regusername" onchange="checkAvail('$scripturl',this.value,'user')" size="30" value="$tmpregname" maxlength="18"$regstyle /> *
           <div id="useravailability"></div>            <div id="useravailability"></div>
           <input type="hidden" name="language" id="language" value="$language" />            <input type="hidden" name="language" id="language" value="$language" />
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="regrealname"><b>$register_txt{'98a'}:</b>~;            <label for="regrealname"><b>$register_txt{'98a'}:</b>~;
   if ($name_cannot_be_userid) {    if ($name_cannot_be_userid) {
       $yymain .= qq~        $yymain .= qq~
           <br /><span class="small">$register_txt{'521'}</span>~;            <br /><span class="small">$register_txt{'521'}</span>~;
   }    }
   $yymain .= qq~</label>    $yymain .= qq~</label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <input type="text" name="regrealname" id="regrealname" onchange="checkAvail('$scripturl',this.value,'display')" size="30" value="$tmprealname" maxlength="30" /> *            <input type="text" name="regrealname" id="regrealname" onchange="checkAvail('$scripturl',this.value,'display')" size="30" value="$tmprealname" maxlength="30" /> *
           <div id="displayavailability"></div>            <div id="displayavailability"></div>
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top"><label for="email"><b>$register_txt{'69'}:</b>        <td class="windowbg" align="right" valign="top"><label for="email"><b>$register_txt{'69'}:</b>
           <br /><span class="small">$register_txt{'679'}</span></label>            <br /><span class="small">$register_txt{'679'}</span></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           $aedomains *            $aedomains *
           <div id="emailavailability"></div>            <div id="emailavailability"></div>
   ~;    ~;
   if ($allow_hide_email == 1) {    if ($allow_hide_email == 1) {
       $yymain .= qq~        $yymain .= qq~
           <br /><input type="checkbox" name="hideemail" id="hideemail" value="1"$hidechecked /> <label for="hideemail">$register_txt{'721'}</label>            <br /><input type="checkbox" name="hideemail" id="hideemail" value="1"$hidechecked /> <label for="hideemail">$register_txt{'721'}</label>
       ~;        ~;
   }    }
   $yymain .= qq~    $yymain .= qq~
       </td>        </td>
   </tr>    </tr>
   ~;    ~;
   
   if ($birthday_on_reg) {    if ($birthday_on_reg) {
       &timetostring($date);        &timetostring($date);
       if ($timeselected =~ /[145]/) {        if ($timeselected =~ /[145]/) {
           $yymain .= qq~            $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="birth_month"><b>$register_txt{'birthday'}:</b></label>            <label for="birth_month"><b>$register_txt{'birthday'}:</b></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top"><input type="text" name="birth_month" id="birth_month" size="2" value="$birthdate[1]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_month','document.creator.birth_day',2)" /> <input type="text" name="birth_day" id="birth_day" size="2" value="$birthdate[0]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_day','document.creator.birth_year',2)" /> <input type="text" name="birth_year" id="birth_year" size="4" value="$birthdate[2]" maxlength="4" />~ . ($birthday_on_reg == 2 ? ' *' : '') . qq~ <span class="small">$register_txt{'birthday_a'}</span>~;        <td class="windowbg2" align="left" valign="top"><input type="text" name="birth_month" id="birth_month" size="2" value="$birthdate[1]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_month','document.creator.birth_day',2)" /> <input type="text" name="birth_day" id="birth_day" size="2" value="$birthdate[0]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_day','document.creator.birth_year',2)" /> <input type="text" name="birth_year" id="birth_year" size="4" value="$birthdate[2]" maxlength="4" />~ . ($birthday_on_reg == 2 ? ' *' : '') . qq~ <span class="small">$register_txt{'birthday_a'}</span>~;
   
       } else {        } else {
           $yymain .= qq~            $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="birth_day"><b>$register_txt{'birthday'}:</b></label>            <label for="birth_day"><b>$register_txt{'birthday'}:</b></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top"><input type="text" name="birth_day" id="birth_day" size="2" value="$birthdate[0]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_day','document.creator.birth_month',2)" /> <input type="text" name="birth_month" id="birth_month" size="2" value="$birthdate[1]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_month','document.creator.birth_year',2)" /> <input type="text" name="birth_year" id="birth_year" size="4" value="$birthdate[2]" maxlength="4" />~ . ($birthday_on_reg == 2 ? ' *' : '') . qq~ <span class="small">$register_txt{'birthday_b'}</span>~;        <td class="windowbg2" align="left" valign="top"><input type="text" name="birth_day" id="birth_day" size="2" value="$birthdate[0]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_day','document.creator.birth_month',2)" /> <input type="text" name="birth_month" id="birth_month" size="2" value="$birthdate[1]" maxlength="2" onkeypress="jumpatnext('document.creator.birth_month','document.creator.birth_year',2)" /> <input type="text" name="birth_year" id="birth_year" size="4" value="$birthdate[2]" maxlength="4" />~ . ($birthday_on_reg == 2 ? ' *' : '') . qq~ <span class="small">$register_txt{'birthday_b'}</span>~;
       }        }
   
       $yymain .= qq~        $yymain .= qq~
       </td>        </td>
   </tr>~;    </tr>~;
   }    }
   
   if ($gender_on_reg) {    if ($gender_on_reg) {
       if ($gender_on_reg == 1) {        if ($gender_on_reg == 1) {
           $gender_req = qq~<label for="gender"><b>$register_txt{'gender'}: </b></label>~;            $gender_req = qq~<label for="gender"><b>$register_txt{'gender'}: </b></label>~;
       }        }
       else {        else {
           $gender_req = qq~* <label for="gender"><b>$register_txt{'gender'}: </b></label>~;            $gender_req = qq~* <label for="gender"><b>$register_txt{'gender'}: </b></label>~;
       }        }
       $yymain .= qq~        $yymain .= qq~
       <tr>        <tr>
           <td class="windowbg" align="right" valign="top">            <td class="windowbg" align="right" valign="top">
               $gender_req                $gender_req
           </td>            </td>
           <td class="windowbg2" align="left" valign="top">            <td class="windowbg2" align="left" valign="top">
               <select name="gender" id="gender" size="1">                <select name="gender" id="gender" size="1">
                   <option value=""></option>                    <option value=""></option>
                   <option value="Male">$register_txt{'gender_male'}</option>                    <option value="Male">$register_txt{'gender_male'}</option>
                   <option value="Female">$register_txt{'gender_female'}</option>                    <option value="Female">$register_txt{'gender_female'}</option>
               </select>                </select>
           </td>            </td>
       </tr>        </tr>
       ~;        ~;
   }    }
   unless ($emailpassword) {    unless ($emailpassword) {
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="passwrd1"><b>$register_txt{'81'}:</b></label>            <label for="passwrd1"><b>$register_txt{'81'}:</b></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <script language="JavaScript1.2" type="text/javascript">            <script language="JavaScript1.2" type="text/javascript">
           <!--            <!--
               // Password_strength_meter start                // Password_strength_meter start
               var verdects = new Array("$pwstrengthmeter_txt{'1'}","$pwstrengthmeter_txt{'2'}","$pwstrengthmeter_txt{'3'}","$pwstrengthmeter_txt{'4'}","$pwstrengthmeter_txt{'5'}","$pwstrengthmeter_txt{'6'}","$pwstrengthmeter_txt{'7'}","$pwstrengthmeter_txt{'8'}");                var verdects = new Array("$pwstrengthmeter_txt{'1'}","$pwstrengthmeter_txt{'2'}","$pwstrengthmeter_txt{'3'}","$pwstrengthmeter_txt{'4'}","$pwstrengthmeter_txt{'5'}","$pwstrengthmeter_txt{'6'}","$pwstrengthmeter_txt{'7'}","$pwstrengthmeter_txt{'8'}");
               var colors = new Array("#8F8F8F","#BF0000","#FF0000","#00A0FF","#33EE00","#339900");                var colors = new Array("#8F8F8F","#BF0000","#FF0000","#00A0FF","#33EE00","#339900");
               var scores = new Array($pwstrengthmeter_scores);                var scores = new Array($pwstrengthmeter_scores);
               var common = new Array($pwstrengthmeter_common);                var common = new Array($pwstrengthmeter_common);
               var minchar = $pwstrengthmeter_minchar;                var minchar = $pwstrengthmeter_minchar;
   
               function runPassword(D) {                function runPassword(D) {
                   var nPerc = checkPassword(D);                    var nPerc = checkPassword(D);
                   if (nPerc > -199 && nPerc < 0) {                    if (nPerc > -199 && nPerc < 0) {
                       strColor = colors[0];                        strColor = colors[0];
                       strText = verdects[1];                        strText = verdects[1];
                       strWidth = "5%";                        strWidth = "5%";
                   } else if (nPerc == -200) {                    } else if (nPerc == -200) {
                       strColor = colors[1];                        strColor = colors[1];
                       strText = verdects[0];                        strText = verdects[0];
                       strWidth = "0%";                        strWidth = "0%";
                   } else if (scores[0] == -1 && scores[1] == -1 && scores[2] == -1 && scores[3] == -1) {                    } else if (scores[0] == -1 && scores[1] == -1 && scores[2] == -1 && scores[3] == -1) {
                       strColor = colors[4];                        strColor = colors[4];
                       strText = verdects[7];                        strText = verdects[7];
                       strWidth = "100%";                        strWidth = "100%";
                   } else if (nPerc <= scores[0]) {                    } else if (nPerc <= scores[0]) {
                       strColor = colors[1];                        strColor = colors[1];
                       strText = verdects[2];                        strText = verdects[2];
                       strWidth = "10%";                        strWidth = "10%";
                   } else if (nPerc > scores[0] && nPerc <= scores[1]) {                    } else if (nPerc > scores[0] && nPerc <= scores[1]) {
                       strColor = colors[2];                        strColor = colors[2];
                       strText = verdects[3];                        strText = verdects[3];
                       strWidth = "25%";                        strWidth = "25%";
                   } else if (nPerc > scores[1] && nPerc <= scores[2]) {                    } else if (nPerc > scores[1] && nPerc <= scores[2]) {
                       strColor = colors[3];                        strColor = colors[3];
                       strText = verdects[4];                        strText = verdects[4];
                       strWidth = "50%";                        strWidth = "50%";
                   } else if (nPerc > scores[2] && nPerc <= scores[3]) {                    } else if (nPerc > scores[2] && nPerc <= scores[3]) {
                       strColor = colors[4];                        strColor = colors[4];
                       strText = verdects[5];                        strText = verdects[5];
                       strWidth = "75%";                        strWidth = "75%";
                   } else {                    } else {
                       strColor = colors[5];                        strColor = colors[5];
                       strText = verdects[6];                        strText = verdects[6];
                       strWidth = "100%";                        strWidth = "100%";
                   }                    }
                   document.getElementById("passwrd1_bar").style.width = strWidth;                    document.getElementById("passwrd1_bar").style.width = strWidth;
                   document.getElementById("passwrd1_bar").style.backgroundColor = strColor;                    document.getElementById("passwrd1_bar").style.backgroundColor = strColor;
                   document.getElementById("passwrd1_text").style.color = strColor;                    document.getElementById("passwrd1_text").style.color = strColor;
                   document.getElementById("passwrd1_text").childNodes[0].nodeValue = strText;                    document.getElementById("passwrd1_text").childNodes[0].nodeValue = strText;
               }                }
   
               function checkPassword(C) {                function checkPassword(C) {
                   if (C.length == 0 || C.length < minchar) return -100;                    if (C.length == 0 || C.length < minchar) return -100;
   
                   for (var D = 0; D < common.length; D++) {                    for (var D = 0; D < common.length; D++) {
                       if (C.toLowerCase() == common[D]) return -200;                        if (C.toLowerCase() == common[D]) return -200;
                   }                    }
   
                   var F = 0;                    var F = 0;
                   if (C.length >= minchar && C.length <= (minchar+2)) {                    if (C.length >= minchar && C.length <= (minchar+2)) {
                       F = (F + 6)                        F = (F + 6)
                   } else if (C.length >= (minchar + 3) && C.length <= (minchar + 4)) {                    } else if (C.length >= (minchar + 3) && C.length <= (minchar + 4)) {
                       F = (F + 12)                        F = (F + 12)
                   } else if (C.length >= (minchar + 5)) {                    } else if (C.length >= (minchar + 5)) {
                       F = (F + 18)                        F = (F + 18)
                   }                    }
   
                   if (C.match(/[a-z]/)) {                    if (C.match(/[a-z]/)) {
                       F = (F + 1)                        F = (F + 1)
                   }                    }
                   if (C.match(/[A-Z]/)) {                    if (C.match(/[A-Z]/)) {
                       F = (F + 5)                        F = (F + 5)
                   }                    }
                   if (C.match(/d+/)) {                    if (C.match(/d+/)) {
                       F = (F + 5)                        F = (F + 5)
                   }                    }
                   if (C.match(/(.*[0-9].*[0-9].*[0-9])/)) {                    if (C.match(/(.*[0-9].*[0-9].*[0-9])/)) {
                       F = (F + 7)                        F = (F + 7)
                   }                    }
                   if (C.match(/.[!,\@,#,\$,\%,^,&,*,?,_,\~]/)) {                    if (C.match(/.[!,\@,#,\$,\%,^,&,*,?,_,\~]/)) {
                       F = (F + 5)                        F = (F + 5)
                   }                    }
                   if (C.match(/(.*[!,\@,#,\$,\%,^,&,*,?,_,\~].*[!,\@,#,\$,\%,^,&,*,?,_,\~])/)) {                    if (C.match(/(.*[!,\@,#,\$,\%,^,&,*,?,_,\~].*[!,\@,#,\$,\%,^,&,*,?,_,\~])/)) {
                       F = (F + 7)                        F = (F + 7)
                   }                    }
                   if (C.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){                    if (C.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){
                       F = (F + 2)                        F = (F + 2)
                   }                    }
                   if (C.match(/([a-zA-Z])/) && C.match(/([0-9])/)) {                    if (C.match(/([a-zA-Z])/) && C.match(/([0-9])/)) {
                       F = (F + 3)                        F = (F + 3)
                   }                    }
                   if (C.match(/([a-zA-Z0-9].*[!,\@,#,\$,\%,^,&,*,?,_,\~])|([!,\@,#,\$,\%,^,&,*,?,_,\~].*[a-zA-Z0-9])/)) {                    if (C.match(/([a-zA-Z0-9].*[!,\@,#,\$,\%,^,&,*,?,_,\~])|([!,\@,#,\$,\%,^,&,*,?,_,\~].*[a-zA-Z0-9])/)) {
                       F = (F + 3)                        F = (F + 3)
                   }                    }
                   return F;                    return F;
               }                }
               // Password_strength_meter end                // Password_strength_meter end
           // -->            // -->
           </script>            </script>
           <div style="float:left;"><input type="password" maxlength="30" name="passwrd1" id="passwrd1" value="$tmpregpasswrd1" size="30" onkeypress="capsLock(event,'cappasswrd1')" onkeyup="runPassword(this.value);" /> *&nbsp;</div>            <div style="float:left;"><input type="password" maxlength="30" name="passwrd1" id="passwrd1" value="$tmpregpasswrd1" size="30" onkeypress="capsLock(event,'cappasswrd1')" onkeyup="runPassword(this.value);" /> *&nbsp;</div>
           <div style="float:left; width: 150px; height: 20px; text-align:left;">            <div style="float:left; width: 150px; height: 20px; text-align:left;">
               <div id="password-strength-meter" style="background: transparent url($imagesdir/empty_bar.gif) repeat-x center left; height: 4px"></div>                <div id="password-strength-meter" style="background: transparent url($imagesdir/empty_bar.gif) repeat-x center left; height: 4px"></div>
               <div class="pstrength-bar" id="passwrd1_bar" style="border: 1px solid #FFFFFF; height: 4px"></div>                <div class="pstrength-bar" id="passwrd1_bar" style="border: 1px solid #FFFFFF; height: 4px"></div>
               <div class="pstrength-info" id="passwrd1_text">&nbsp;</div>                <div class="pstrength-info" id="passwrd1_text">&nbsp;</div>
           </div>            </div>
           <div style="clear:left; color: red; font-weight: bold; display: none" id="cappasswrd1">$register_txt{'capslock'}</div>            <div style="clear:left; color: red; font-weight: bold; display: none" id="cappasswrd1">$register_txt{'capslock'}</div>
           <div style="clear:left; color: red; font-weight: bold; display: none" id="cappasswrd1_char">$register_txt{'wrong_char'}: <span id="cappasswrd1_character">&nbsp;</span></div>            <div style="clear:left; color: red; font-weight: bold; display: none" id="cappasswrd1_char">$register_txt{'wrong_char'}: <span id="cappasswrd1_character">&nbsp;</span></div>
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="passwrd2"><b>$register_txt{'82'}:</b></label>            <label for="passwrd2"><b>$register_txt{'82'}:</b></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <input type="password" maxlength="30" name="passwrd2" id="passwrd2" value="$tmpregpasswrd2" size="30" onkeypress="capsLock(event,'cappasswrd2')" /> *            <input type="password" maxlength="30" name="passwrd2" id="passwrd2" value="$tmpregpasswrd2" size="30" onkeypress="capsLock(event,'cappasswrd2')" /> *
           <div style="color: red; font-weight: bold; display: none" id="cappasswrd2">$register_txt{'capslock'}</div>            <div style="color: red; font-weight: bold; display: none" id="cappasswrd2">$register_txt{'capslock'}</div>
           <div style="color: red; font-weight: bold; display: none" id="cappasswrd2_char">$register_txt{'wrong_char'}: <span id="cappasswrd2_character">&nbsp;</span></div>            <div style="color: red; font-weight: bold; display: none" id="cappasswrd2_char">$register_txt{'wrong_char'}: <span id="cappasswrd2_character">&nbsp;</span></div>
       </td>        </td>
   </tr>~;    </tr>~;
   }    }
   
   if ($addmemgroup_enabled == 1 || $addmemgroup_enabled == 3) {    if ($addmemgroup_enabled == 1 || $addmemgroup_enabled == 3) {
       my ($title, $additional, $addmemgroup, $selsize);        my ($title, $additional, $addmemgroup, $selsize);
       foreach (@nopostorder) {        foreach (@nopostorder) {
           ($title, undef, undef, undef, undef, undef, undef, undef, undef, undef, $additional) = split(/\|/, $NoPost{$_});            ($title, undef, undef, undef, undef, undef, undef, undef, undef, undef, $additional) = split(/\|/, $NoPost{$_});
           if ($additional) {            if ($additional) {
               $addmemgroup .= qq~<option value="$_">$title</option>~;                $addmemgroup .= qq~<option value="$_">$title</option>~;
               $selsize++;                $selsize++;
           }            }
       }        }
       $selsize = $selsize > 6 ? 6 : $selsize;        $selsize = $selsize > 6 ? 6 : $selsize;
       my $additional_explain = $addmemgroup_enabled == 1 ? $register_txt{'766'} : $register_txt{'767'};        my $additional_explain = $addmemgroup_enabled == 1 ? $register_txt{'766'} : $register_txt{'767'};
       $additional_explain .= $register_txt{'767a'} if $selsize > 1;        $additional_explain .= $register_txt{'767a'} if $selsize > 1;
   
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="joinmemgroup"><b>$register_txt{'765'}:</b>            <label for="joinmemgroup"><b>$register_txt{'765'}:</b>
           <br /><span class="small">$additional_explain</span></label>            <br /><span class="small">$additional_explain</span></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <select name="joinmemgroup" id="joinmemgroup" size="$selsize" multiple="multiple">            <select name="joinmemgroup" id="joinmemgroup" size="$selsize" multiple="multiple">
           $addmemgroup            $addmemgroup
           </select>            </select>
       </td>        </td>
   </tr>~ if $addmemgroup;    </tr>~ if $addmemgroup;
   }    }
   
   if ($regtype == 1) {    if ($regtype == 1) {
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="reason"><b>$prereg_txt{'regreason'}:</b><br />            <label for="reason"><b>$prereg_txt{'regreason'}:</b><br />
           <span class="small">$prereg_txt{'reason_exp'}</span></label><br /><br />            <span class="small">$prereg_txt{'reason_exp'}</span></label><br /><br />
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <textarea cols="60" rows="7" name="reason" id="reason">$reason</textarea> *<br />            <textarea cols="60" rows="7" name="reason" id="reason">$reason</textarea> *<br />
           <span class="small">$prereg_txt{'16'} <input value="$RegReasonSymbols" size="~ . length($RegReasonSymbols) . qq~" name="msgCL" class="windowbg" style="border: 0px; padding: 1px; font-size: 11px;" readonly="readonly" /></span>            <span class="small">$prereg_txt{'16'} <input value="$RegReasonSymbols" size="~ . length($RegReasonSymbols) . qq~" name="msgCL" class="windowbg" style="border: 0px; padding: 1px; font-size: 11px;" readonly="readonly" /></span>
           <script type="text/javascript" language="JavaScript">            <script type="text/javascript" language="JavaScript">
           <!--            <!--
           var supportsKeys = false;            var supportsKeys = false;
           function tick() {            function tick() {
               calcCharLeft(document.forms[0]);                calcCharLeft(document.forms[0]);
               if (!supportsKeys) { timerID = setTimeout("tick()",$RegReasonSymbols); }                if (!supportsKeys) { timerID = setTimeout("tick()",$RegReasonSymbols); }
           }            }
           function calcCharLeft(sig) {            function calcCharLeft(sig) {
               clipped = false;                clipped = false;
               maxLength = $RegReasonSymbols;                maxLength = $RegReasonSymbols;
               if (document.creator.reason.value.length > maxLength) {                if (document.creator.reason.value.length > maxLength) {
                   document.creator.reason.value = document.creator.reason.value.substring(0,maxLength);                    document.creator.reason.value = document.creator.reason.value.substring(0,maxLength);
                   charleft = 0;                    charleft = 0;
                   clipped = true;                    clipped = true;
               } else {                } else {
                   charleft = maxLength - document.creator.reason.value.length;                    charleft = maxLength - document.creator.reason.value.length;
               }                }
               document.creator.msgCL.value = charleft;                document.creator.msgCL.value = charleft;
               return clipped;                return clipped;
           }            }
           tick();            tick();
           //-->            //-->
           </script>            </script>
       </td>        </td>
   </tr>~;    </tr>~;
   }    }
   
   if ($extendedprofiles) {    if ($extendedprofiles) {
       require "$sourcedir/ExtendedProfiles.pl";        require "$sourcedir/ExtendedProfiles.pl";
       my $reg_ext_prof = &ext_register;        my $reg_ext_prof = &ext_register;
       $reg_ext_prof =~ s/align="left" valign="top"/align="right" valign="top"/g;        $reg_ext_prof =~ s/align="left" valign="top"/align="right" valign="top"/g;
       $reg_ext_prof =~ s/<\/td><td align="left">/<\/td><td class="windowbg2" align="left">/g;        $reg_ext_prof =~ s/<\/td><td align="left">/<\/td><td class="windowbg2" align="left">/g;
       $yymain .= $reg_ext_prof;        $yymain .= $reg_ext_prof;
   }    }
   
   if ($regcheck) {    if ($regcheck) {
       require "$sourcedir/Decoder.pl";        require "$sourcedir/Decoder.pl";
       &validation_code;        &validation_code;
   
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="verification"><b>$floodtxt{'1'}:</b><br />            <label for="verification"><b>$floodtxt{'1'}:</b><br />
           <span class="small">$floodtxt{'casewarning'}</span></label>            <span class="small">$floodtxt{'casewarning'}</span></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="middle">        <td class="windowbg2" align="left" valign="middle">
           $showcheck            $showcheck
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="verification"><b>$floodtxt{'3'}:</b></label>            <label for="verification"><b>$floodtxt{'3'}:</b></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <input type="text" maxlength="30" name="verification" id="verification" size="30" /> *            <input type="text" maxlength="30" name="verification" id="verification" size="30" /> *
       </td>        </td>
   </tr>~;    </tr>~;
   }    }
   if ($en_spam_questions) {    if ($en_spam_questions) {
       srand;        srand;
       fopen(SPAMQUESTIONS, "<$vardir/spam.questions") || &fatal_error("cannot_open","$vardir/spam.questions", 1);        fopen(SPAMQUESTIONS, "<$langdir/$language/spam.questions") || &fatal_error("cannot_open","$langdir/$language/spam.questions", 1);
       rand($.) < 1 && ($spam_question_rand = $_) while <SPAMQUESTIONS>;        rand($.) < 1 && ($spam_question_rand = $_) while <SPAMQUESTIONS>;
       fclose(SPAMQUESTIONS);        fclose(SPAMQUESTIONS);
       ($spam_question_id, $spam_question, undef) = split(/\|/, $spam_question_rand);        ($spam_question_id, $spam_question, undef) = split(/\|/, $spam_question_rand);
       if ($spam_questions_case) { $verification_question_desc = qq~<br />$register_txt{'verification_question_case'}~; }        if ($spam_questions_case) { $verification_question_desc = qq~<br />$register_txt{'verification_question_case'}~; }
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" align="right" valign="top">        <td class="windowbg" align="right" valign="top">
           <label for="verification_question"><b>$spam_question</b><br />            <label for="verification_question"><b>$spam_question</b><br />
           <span class="small">$register_txt{'verification_question_desc'}$verification_question_desc</span></label>            <span class="small">$register_txt{'verification_question_desc'}$verification_question_desc</span></label>
       </td>        </td>
       <td class="windowbg2" align="left" valign="top">        <td class="windowbg2" align="left" valign="top">
           <input type="text" name="verification_question" id="verification_question" size="30" /> *            <input type="text" name="verification_question" id="verification_question" size="30" /> *
           <input type="hidden" name="verification_question_id" value="$spam_question_id" />            <input type="hidden" name="verification_question_id" value="$spam_question_id" />
       </td>        </td>
   </tr>~;    </tr>~;
   }    }
   
   if ($RegAgree) {    if ($RegAgree) {
       if ($language) {        if ($language) {
           fopen(AGREE, "$langdir/$language/agreement.txt");            fopen(AGREE, "$langdir/$language/agreement.txt");
       } else {        } else {
           fopen(AGREE, "$langdir/$lang/agreement.txt");            fopen(AGREE, "$langdir/$lang/agreement.txt");
       }        }
       @agreement = <AGREE>;        @agreement = <AGREE>;
       fclose(AGREE);        fclose(AGREE);
       $fullagree = join("", @agreement);        $fullagree = join("", @agreement);
       $fullagree =~ s/\n/<br \/>/g;        $fullagree =~ s/\n/<br \/>/g;
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td colspan="2" class="titlebg">        <td colspan="2" class="titlebg">
           <img src="$imagesdir/xx.gif" alt="$register_txt{'764a'}" title="$register_txt{'764a'}" border="0" /> <b>$register_txt{'764a'}</b>            <img src="$imagesdir/xx.gif" alt="$register_txt{'764a'}" title="$register_txt{'764a'}" border="0" /> <b>$register_txt{'764a'}</b>
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td colspan="2" class="windowbg">        <td colspan="2" class="windowbg">
           <label for="regagree"><span style="float: left; padding: 5px;">$fullagree</span></label>            <label for="regagree"><span style="float: left; padding: 5px;">$fullagree</span></label>
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td colspan="2" class="windowbg2" align="center">        <td colspan="2" class="windowbg2" align="center">
           <label for="regagree"><b>$register_txt{'585'}</b></label> <input type="radio" name="regagree" id="regagree" value="yes" /> * &nbsp;&nbsp; <label for="regnoagree"><b>$register_txt{'586'}</b></label> <input type="radio" name="regagree" id="regnoagree" value="no" />            <label for="regagree"><b>$register_txt{'585'}</b></label> <input type="radio" name="regagree" id="regagree" value="yes" /> * &nbsp;&nbsp; <label for="regnoagree"><b>$register_txt{'586'}</b></label> <input type="radio" name="regagree" id="regnoagree" value="no" />
       </td>        </td>
   </tr>~;    </tr>~;
   }    }
     if ($honeypot == 1) {  
             fopen(HONEY, "<$langdir/$language/honey.txt") || &fatal_error("cannot_open","$langdir/$language/honey.txt", 1);  
             @honey = <HONEY>;  
             fclose(HONEY);  
             chomp @honey;  
           $hony = int rand $#honey;  
         $newfieldb = $honey[$hony];  
   
         $yymain .= qq~  
         <tr class="green">  
             <td class="windowbg" align="right" valign="top" class="green">  
                 <label for="add_field0" class="green"><b>$newfieldb</b>  
             </td>  
             <td class="windowbg2" align="left" valign="top" class="green">  
                 <input autocomplete="off" type="text" name="add_field0" id="add_field0" size="30" value="$newfield" maxlength="18" class="green" /> *  
             </td>  
         </tr>~;  
     }  
   $yymain .= qq~    $yymain .= qq~
   <tr class="green">    
       <td class="windowbg" align="right" valign="top" class="green">    
           <label for="add_field0" class="green"><b>$newfieldb</b>    
       </td>    
       <td class="windowbg2" align="left" valign="top" class="green">    
           <input autocomplete="off" type="text" name="add_field0" id="add_field0" size="30" value="$newfield" maxlength="18" class="green" /> *    
       </td>    
   </tr>    
   <tr>    <tr>
       <td colspan="2" align="center" class="titlebg">        <td colspan="2" align="center" class="titlebg">
           <br />            <br />
           <label for="submitbutton">$register_txt{'95'}</label><br />            <label for="submitbutton">$register_txt{'95'}</label><br />
           <br />            <br />
           <input type="submit" id="submitbutton" value="$register_txt{'97'}" class="button" /><br /><br />            <input type="submit" id="submitbutton" value="$register_txt{'97'}" class="button" /><br /><br />
       </td>        </td>
   </tr>    </tr>
</table> </table>
</form> </form>
   
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
   document.creator.regusername.focus();    document.creator.regusername.focus();
   
   function CheckRegFields() {    function CheckRegFields() {
       if (document.creator.regusername.value == '') {        if (document.creator.regusername.value == '') {
           alert("$register_txt{'error_username'}");            alert("$register_txt{'error_username'}");
           document.creator.regusername.focus();            document.creator.regusername.focus();
           return false;            return false;
       }        }
       if (document.creator.regusername.value == document.creator.passwrd1.value || document.creator.regrealname.value == document.creator.passwrd1.value) {        if (document.creator.regusername.value == document.creator.passwrd1.value || document.creator.regrealname.value == document.creator.passwrd1.value) {
           alert("$register_txt{'error_usernameispass'}");            alert("$register_txt{'error_usernameispass'}");
           document.creator.regusername.focus();            document.creator.regusername.focus();
           return false;            return false;
       }        }
       if (document.creator.regrealname.value == '') {        if (document.creator.regrealname.value == '') {
           alert("$register_txt{'error_realname'}");            alert("$register_txt{'error_realname'}");
           document.creator.regrealname.focus();            document.creator.regrealname.focus();
           return false;            return false;
       }~ .        }~ .
   
       ($name_cannot_be_userid ? qq~        ($name_cannot_be_userid ? qq~
       if (document.creator.regusername.value == document.creator.regrealname.value) {        if (document.creator.regusername.value == document.creator.regrealname.value) {
           alert("$register_txt{'error_name_cannot_be_userid'}");            alert("$register_txt{'error_name_cannot_be_userid'}");
           document.creator.regrealname.focus();            document.creator.regrealname.focus();
           return false;            return false;
       }~ : '')        }~ : '')
   
       . qq~        . qq~
       if (document.creator.email.value == '') {        if (document.creator.email.value == '') {
           alert("$register_txt{'error_email'}");            alert("$register_txt{'error_email'}");
           document.creator.email.focus();            document.creator.email.focus();
           return false;            return false;
       }~ .        }~ .
   
       ($birthday_on_reg ? qq~        ($birthday_on_reg ? qq~
       if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_day.value.length && ' : '') . qq~(document.creator.birth_day.value.length < 2 || document.creator.birth_day.value < 1 || document.creator.birth_day.value > 31 || /\\D/.test(document.creator.birth_day.value))) {        if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_day.value.length && ' : '') . qq~(document.creator.birth_day.value.length < 2 || document.creator.birth_day.value < 1 || document.creator.birth_day.value > 31 || /\\D/.test(document.creator.birth_day.value))) {
           alert("$register_txt{'error_birth_day'}");            alert("$register_txt{'error_birth_day'}");
           document.creator.birth_day.focus();            document.creator.birth_day.focus();
           return false;            return false;
       }        }
       if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_month.value.length && ' : '') . qq~(document.creator.birth_month.value.length < 2 || document.creator.birth_month.value < 1 || document.creator.birth_month.value > 12 || /\\D/.test(document.creator.birth_month.value))) {        if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_month.value.length && ' : '') . qq~(document.creator.birth_month.value.length < 2 || document.creator.birth_month.value < 1 || document.creator.birth_month.value > 12 || /\\D/.test(document.creator.birth_month.value))) {
           alert("$register_txt{'error_birth_month'}");            alert("$register_txt{'error_birth_month'}");
           document.creator.birth_month.focus();            document.creator.birth_month.focus();
           return false;            return false;
       }        }
       if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_year.value.length && ' : '') . qq~(document.creator.birth_year.value.length < 4 || /\\D/.test(document.creator.birth_year.value))) {        if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_year.value.length && ' : '') . qq~(document.creator.birth_year.value.length < 4 || /\\D/.test(document.creator.birth_year.value))) {
           alert("$register_txt{'error_birth_year'}");            alert("$register_txt{'error_birth_year'}");
           document.creator.birth_year.focus();            document.creator.birth_year.focus();
           return false;            return false;
       }        }
       if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_year.value.length && ' : '') . qq~(document.creator.birth_year.value < ($year - 120) || document.creator.birth_year.value > $year)) {        if (~ . ($birthday_on_reg == 1 ? 'document.creator.birth_year.value.length && ' : '') . qq~(document.creator.birth_year.value < ($year - 120) || document.creator.birth_year.value > $year)) {
           alert("$register_txt{'error_birth_year_real'}");            alert("$register_txt{'error_birth_year_real'}");
           document.creator.birth_year.focus();            document.creator.birth_year.focus();
           return false;            return false;
       }~ : '')        }~ : '')
   
       . qq~        . qq~
       if ($emailpassword == 0) {        if ($emailpassword == 0) {
           if (document.creator.passwrd1.value == '' || document.creator.passwrd2.value == '') {            if (document.creator.passwrd1.value == '' || document.creator.passwrd2.value == '') {
               alert("$register_txt{'error_pass1'}");                alert("$register_txt{'error_pass1'}");
               document.creator.passwrd1.focus();                document.creator.passwrd1.focus();
               return false;                return false;
           }            }
           if (document.creator.passwrd1.value != document.creator.passwrd2.value) {            if (document.creator.passwrd1.value != document.creator.passwrd2.value) {
               alert("$register_txt{'error_pass2'}");                alert("$register_txt{'error_pass2'}");
               document.creator.passwrd1.focus();                document.creator.passwrd1.focus();
               return false;                return false;
           }            }
       }        }
       if ($regcheck > 0 && document.creator.verification.value == '') {        if ($regcheck > 0 && document.creator.verification.value == '') {
           alert("$register_txt{'error_verification'}");            alert("$register_txt{'error_verification'}");
           document.creator.verification.focus();            document.creator.verification.focus();
           return false;            return false;
       }~ .        }~ .
   
       ($en_spam_questions ? qq~        ($en_spam_questions ? qq~
       if (document.creator.verification_question.value == '') {        if (document.creator.verification_question.value == '') {
           alert("$register_txt{'error_verification_question'}");            alert("$register_txt{'error_verification_question'}");
           document.creator.verification_question.focus();            document.creator.verification_question.focus();
           return false;            return false;
       }~ : '')        }~ : '')
   
       . qq~        . qq~
       if ($regtype == 1 && document.creator.reason.value == '') {        if ($regtype == 1 && document.creator.reason.value == '') {
           alert("$register_txt{'error_reason'}");            alert("$register_txt{'error_reason'}");
           document.creator.reason.focus();            document.creator.reason.focus();
           return false;            return false;
       }        }
       if ($RegAgree > 0 && document.creator.regagree[0].checked != true) {        if ($RegAgree > 0 && document.creator.regagree[0].checked != true) {
           alert("$register_txt{'error_agree'}");            alert("$register_txt{'error_agree'}");
           return false;            return false;
       }        }
   
       if ($gender_on_reg > 1 && document.creator.gender.value) {        if ($gender_on_reg > 1 && document.creator.gender.value) {
           alert("$register_txt{'error_gender'}");            alert("$register_txt{'error_gender'}");
           document.creator.gender.focus();            document.creator.gender.focus();
           return false            return false
       }        }
       return true;        return true;
   }    }
   
   function jumpatnext(from,to,length) {    function jumpatnext(from,to,length) {
       window.setTimeout('if (' + from + '.value.length == ' + length + ') ' + to + '.focus();', 1);        window.setTimeout('if (' + from + '.value.length == ' + length + ') ' + to + '.focus();', 1);
   }    }
//--> //-->
</script> </script>
   ~;    ~;
   &template;    &template;
} }
   
sub Register2 { sub Register2 {
   if (!$regtype) { &fatal_error("registration_disabled"); }    if (!$regtype) { &fatal_error("registration_disabled"); }
   if ($RegAgree && $FORM{'regagree'} ne 'yes') { &fatal_error('no_regagree'); }    if ($RegAgree && $FORM{'regagree'} ne 'yes') { &fatal_error('no_regagree'); }
   my %member;    my %member;
   while (($key, $value) = each(%FORM)) {    while (($key, $value) = each(%FORM)) {
       $value =~ s~\A\s+~~;        $value =~ s~\A\s+~~;
       $value =~ s~\s+\Z~~;        $value =~ s~\s+\Z~~;
       unless ($key eq "reason") {$value =~ s~[\n\r]~~g;}        unless ($key eq "reason") {$value =~ s~[\n\r]~~g;}
       $member{$key} = $value;        $member{$key} = $value;
   }    }
   if ($member{'domain'}) { $member{'email'} .= $member{'domain'}; }    if ($member{'domain'}) { $member{'email'} .= $member{'domain'}; }
   $member{'regusername'} =~ s/\s/_/g;    $member{'regusername'} =~ s/\s/_/g;
   $member{'regrealname'} =~ s~\t+~\ ~g;    $member{'regrealname'} =~ s~\t+~\ ~g;
   
   # Make sure users can't register with banned details    # Make sure users can't register with banned details
   &email_domain_check($member{'email'});    &email_domain_check($member{'email'});
   &banning($member{'regusername'}, $member{'email'});    &banning($member{'regusername'}, $member{'email'});
   
   # check if there is a system hash named like this by checking existence through size    # check if there is a system hash named like this by checking existence through size
   &fatal_error("system_prohibited_id", "($member{'regusername'})") if keys(%{ $member{'regusername'} }) > 0;    &fatal_error("system_prohibited_id", "($member{'regusername'})") if keys(%{ $member{'regusername'} }) > 0;
   &fatal_error("id_to_long","($member{'regusername'})") if length($member{'regusername'}) > 25;    &fatal_error("id_to_long","($member{'regusername'})") if length($member{'regusername'}) > 25;
   &fatal_error("email_to_long","($member{'email'})") if length($member{'email'}) > 100;    &fatal_error("email_to_long","($member{'email'})") if length($member{'email'}) > 100;
   &fatal_error("no_username","($member{'regusername'})") if $member{'regusername'} eq '';    &fatal_error("no_username","($member{'regusername'})") if $member{'regusername'} eq '';
   &fatal_error("id_alfa_only","($member{'regusername'})") if $member{'regusername'} eq '_';    &fatal_error("id_alfa_only","($member{'regusername'})") if $member{'regusername'} eq '_';
   &fatal_error("id_reserved","$member{'regusername'}") if $member{'regusername'} =~ /guest/i;    &fatal_error("id_reserved","$member{'regusername'}") if $member{'regusername'} =~ /guest/i;
   &fatal_error("invalid_character","$register_txt{'35'} $register_txt{'241re'}") if $member{'regusername'} =~ /[^\w\+\-\.\@]/;    &fatal_error("invalid_character","$register_txt{'35'} $register_txt{'241re'}") if $member{'regusername'} =~ /[^\w\+\-\.\@]/;
   &fatal_error("no_email","($member{'regusername'})") if $member{'email'} eq "";    &fatal_error("no_email","($member{'regusername'})") if $member{'email'} eq "";
   &fatal_error("id_taken","($member{'regusername'})") if -e ("$memberdir/$member{'regusername'}.vars");    &fatal_error("id_taken","($member{'regusername'})") if -e ("$memberdir/$member{'regusername'}.vars");
   &fatal_error("password_is_userid") if $member{'regusername'} eq $member{'passwrd1'};    &fatal_error("password_is_userid") if $member{'regusername'} eq $member{'passwrd1'};
   &fatal_error("no_reg_reason") if $member{'reason'} eq "" && $regtype == 1;    &fatal_error("no_reg_reason") if $member{'reason'} eq "" && $regtype == 1;
   
   &FromChars($member{'regrealname'});    &FromChars($member{'regrealname'});
   $convertstr = $member{'regrealname'};    $convertstr = $member{'regrealname'};
   $convertcut = 30;    $convertcut = 30;
   &CountChars;    &CountChars;
     $member{'regrealname'} = $convertstr;      $member{'regrealname'} = $convertstr;
   &fatal_error("realname_to_long","($member{'regrealname'} => $convertstr)") if $cliped;    &fatal_error("realname_to_long","($member{'regrealname'} => $convertstr)") if $cliped;
   &fatal_error('invalid_character', "$register_txt{'38'} $register_txt{'241re'}") if $member{'regrealname'} =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/;    &fatal_error('invalid_character', "$register_txt{'38'} $register_txt{'241re'}") if $member{'regrealname'} =~ /[^ \w\x80-\xFF\[\]\(\)#\%\+,\-\|\.:=\?\@\^]/;
   
   if ($name_cannot_be_userid && lc $member{'regusername'} eq lc $member{'regrealname'}) { &fatal_error('name_is_userid'); }    if ($name_cannot_be_userid && lc $member{'regusername'} eq lc $member{'regrealname'}) { &fatal_error('name_is_userid'); }
   
   if (lc $member{'regusername'} eq lc &MemberIndex("check_exist", $member{'regusername'})) { &fatal_error("id_taken","($member{'regusername'})"); }    if (lc $member{'regusername'} eq lc &MemberIndex("check_exist", $member{'regusername'})) { &fatal_error("id_taken","($member{'regusername'})"); }
   if (lc $member{'email'} eq lc &MemberIndex("check_exist", $member{'email'})) { &fatal_error("email_taken","($member{'email'})"); }    if (lc $member{'email'} eq lc &MemberIndex("check_exist", $member{'email'})) { &fatal_error("email_taken","($member{'email'})"); }
   if (lc $member{'regrealname'} eq lc &MemberIndex("check_exist", $member{'regrealname'})) { &fatal_error("name_taken"); }    if (lc $member{'regrealname'} eq lc &MemberIndex("check_exist", $member{'regrealname'})) { &fatal_error("name_taken"); }
   if ( &CheckCensor($member{'regusername'}) ne "" ) { &fatal_error("censor1",&CheckCensor($member{'regusername'})); }    if ( &CheckCensor($member{'regusername'}) ne "" ) { &fatal_error("censor1",&CheckCensor($member{'regusername'})); }
   if ( &CheckCensor($member{'email'}) ne "" ) { &fatal_error("censor2",&CheckCensor($member{'email'})); }    if ( &CheckCensor($member{'email'}) ne "" ) { &fatal_error("censor2",&CheckCensor($member{'email'})); }
   if ( &CheckCensor($member{'regrealname'}) ne "" ) { &fatal_error("censor3",&CheckCensor($member{'regrealname'})); }    if ( &CheckCensor($member{'regrealname'}) ne "" ) { &fatal_error("censor3",&CheckCensor($member{'regrealname'})); }
   if ( $member{'add_field0'} ne q{}) {&fatal_error("bad_bot");}    if ( $honeypot == 1 && $member{'add_field0'} ne q{}) {&fatal_error("bad_bot");}
   
   if ($regtype == 1) {    if ($regtype == 1) {
       $convertstr = $member{'reason'};        $convertstr = $member{'reason'};
       $convertcut = $RegReasonSymbols;        $convertcut = $RegReasonSymbols;
       &CountChars;        &CountChars;
       $member{'reason'} = $convertstr;        $member{'reason'} = $convertstr;
   
       &FromChars($member{'reason'});        &FromChars($member{'reason'});
       &ToHTML($member{'reason'});        &ToHTML($member{'reason'});
       &ToChars($member{'reason'});        &ToChars($member{'reason'});
       $member{'reason'} =~ s~[\n\r]{1,2}~<br />~ig;        $member{'reason'} =~ s~[\n\r]{1,2}~<br />~ig;
   }    }
   
   if ($regcheck) { require "$sourcedir/Decoder.pl"; &validation_check($member{'verification'}); }    if ($regcheck) { require "$sourcedir/Decoder.pl"; &validation_check($member{'verification'}); }
   if ($en_spam_questions) {    if ($en_spam_questions) {
       fopen(SPAMQUESTIONS, "<$vardir/spam.questions") || &fatal_error("cannot_open","$vardir/spam.questions", 1);        fopen(SPAMQUESTIONS, "<$langdir/$language/spam.questions") || &fatal_error("cannot_open","$langdir/$language/spam.questions", 1);
       @spam_questions = <SPAMQUESTIONS>;        @spam_questions = <SPAMQUESTIONS>;
       fclose(SPAMQUESTIONS);        fclose(SPAMQUESTIONS);
       foreach my $verification_question (@spam_questions) {        foreach my $verification_question (@spam_questions) {
           chomp $verification_question;            chomp $verification_question;
           if ($verification_question =~ /$member{'verification_question_id'}/) {            if ($verification_question =~ /$member{'verification_question_id'}/) {
              (undef, undef, $verification_answer) = split(/\|/, $verification_question);               (undef, undef, $verification_answer) = split(/\|/, $verification_question);
           }            }
       }        }
       $member{'verification_question'} =~ s/\A\s+//;        $member{'verification_question'} =~ s/\A\s+//;
       $member{'verification_question'} =~ s/\s+\Z//;        $member{'verification_question'} =~ s/\s+\Z//;
       unless ($spam_questions_case) {        unless ($spam_questions_case) {
           $verification_answer = lc($verification_answer);            $verification_answer = lc($verification_answer);
           $member{'verification_question'} = lc($member{'verification_question'});            $member{'verification_question'} = lc($member{'verification_question'});
       }        }
       &fatal_error("no_verification_question") if $member{'verification_question'} eq '';        &fatal_error("no_verification_question") if $member{'verification_question'} eq '';
       @verificationanswer = split(/,/, $verification_answer);        @verificationanswer = split(/,/, $verification_answer);
       foreach (@verificationanswer) {        foreach (@verificationanswer) {
           $_ =~ s/\A\s+//;            $_ =~ s/\A\s+//;
           $_ =~ s/\s+\Z//;            $_ =~ s/\s+\Z//;
       }        }
       unless (grep { $member{'verification_question'} eq $_ } @verificationanswer) { &fatal_error("wrong_verification_question"); }        unless (grep { $member{'verification_question'} eq $_ } @verificationanswer) { &fatal_error("wrong_verification_question"); }
   }    }
   
   if ($emailpassword) {    if ($emailpassword) {
       srand();        srand();
       $member{'passwrd1'} = int(rand(100));        $member{'passwrd1'} = int(rand(100));
       $member{'passwrd1'} =~ tr/0123456789/ymifxupbck/;        $member{'passwrd1'} =~ tr/0123456789/ymifxupbck/;
       $_ = int(rand(77));        $_ = int(rand(77));
       $_ =~ tr/0123456789/q8dv7w4jm3/;        $_ =~ tr/0123456789/q8dv7w4jm3/;
       $member{'passwrd1'} .= $_;        $member{'passwrd1'} .= $_;
       $_ = int(rand(89));        $_ = int(rand(89));
       $_ =~ tr/0123456789/y6uivpkcxw/;        $_ =~ tr/0123456789/y6uivpkcxw/;
       $member{'passwrd1'} .= $_;        $member{'passwrd1'} .= $_;
       $_ = int(rand(188));        $_ = int(rand(188));
       $_ =~ tr/0123456789/poiuytrewq/;        $_ =~ tr/0123456789/poiuytrewq/;
       $member{'passwrd1'} .= $_;        $member{'passwrd1'} .= $_;
       $_ = int(rand(65));        $_ = int(rand(65));
       $_ =~ tr/0123456789/lkjhgfdaut/;        $_ =~ tr/0123456789/lkjhgfdaut/;
       $member{'passwrd1'} .= $_;        $member{'passwrd1'} .= $_;
   } else {    } else {
       &fatal_error("password_mismatch","($member{'regusername'})") if $member{'passwrd1'} ne $member{'passwrd2'};        &fatal_error("password_mismatch","($member{'regusername'})") if $member{'passwrd1'} ne $member{'passwrd2'};
       &fatal_error("no_password","($member{'regusername'})") if $member{'passwrd1'} eq '';        &fatal_error("no_password","($member{'regusername'})") if $member{'passwrd1'} eq '';
       &fatal_error("invalid_character","$register_txt{'36'} $register_txt{'241'}") if $member{'passwrd1'} =~ /[^\s\w!\@#\$\%\^&\*\(\)\+\|`~\-=\\:;'",\.\/\?\[\]\{\}]/;        &fatal_error("invalid_character","$register_txt{'36'} $register_txt{'241'}") if $member{'passwrd1'} =~ /[^\s\w!\@#\$\%\^&\*\(\)\+\|`~\-=\\:;'",\.\/\?\[\]\{\}]/;
   }    }
   &fatal_error("invalid_character","$register_txt{'69'} $register_txt{'241e'}") if $member{'email'} !~ /^[\w\-\.\+]+\@[\w\-\.\+]+\.\w{2,4}$/;    &fatal_error("invalid_character","$register_txt{'69'} $register_txt{'241e'}") if $member{'email'} !~ /^[\w\-\.\+]+\@[\w\-\.\+]+\.\w{2,4}$/;
   &fatal_error("invalid_email") if $member{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/ || $member{'email'} !~ /\A.+@\[?(\w|[-.])+\.[a-zA-Z]{2,4}|[0-9]{1,4}\]?\Z/;    &fatal_error("invalid_email") if $member{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/ || $member{'email'} !~ /\A.+@\[?(\w|[-.])+\.[a-zA-Z]{2,4}|[0-9]{1,4}\]?\Z/;
   
   fopen(RESERVE, "$vardir/reserve.txt") || &fatal_error("cannot_open","$vardir/reserve.txt", 1);    fopen(RESERVE, "$vardir/reserve.txt") || &fatal_error("cannot_open","$vardir/reserve.txt", 1);
   @reserve = <RESERVE>;    @reserve = <RESERVE>;
   fclose(RESERVE);    fclose(RESERVE);
   fopen(RESERVECFG, "$vardir/reservecfg.txt") || &fatal_error("cannot_open","$vardir/reservecfg.txt", 1);    fopen(RESERVECFG, "$vardir/reservecfg.txt") || &fatal_error("cannot_open","$vardir/reservecfg.txt", 1);
   @reservecfg = <RESERVECFG>;    @reservecfg = <RESERVECFG>;
   fclose(RESERVECFG);    fclose(RESERVECFG);
   for ($a = 0; $a < @reservecfg; $a++) {    for ($a = 0; $a < @reservecfg; $a++) {
       chomp $reservecfg[$a];        chomp $reservecfg[$a];
   }    }
   $matchword = $reservecfg[0] eq 'checked';    $matchword = $reservecfg[0] eq 'checked';
   $matchcase = $reservecfg[1] eq 'checked';    $matchcase = $reservecfg[1] eq 'checked';
   $matchuser = $reservecfg[2] eq 'checked';    $matchuser = $reservecfg[2] eq 'checked';
   $matchname = $reservecfg[3] eq 'checked';    $matchname = $reservecfg[3] eq 'checked';
   $namecheck = $matchcase eq 'checked' ? $member{'regusername'} : lc $member{'regusername'};    $namecheck = $matchcase eq 'checked' ? $member{'regusername'} : lc $member{'regusername'};
   $realnamecheck = $matchcase eq 'checked' ? $member{'regrealname'} : lc $member{'regrealname'};    $realnamecheck = $matchcase eq 'checked' ? $member{'regrealname'} : lc $member{'regrealname'};
   
   foreach $reserved (@reserve) {    foreach $reserved (@reserve) {
       chomp $reserved;        chomp $reserved;
       $reservecheck = $matchcase ? $reserved : lc $reserved;        $reservecheck = $matchcase ? $reserved : lc $reserved;
       if ($matchuser) {        if ($matchuser) {
           if ($matchword) {            if ($matchword) {
               if ($namecheck eq $reservecheck) { &fatal_error('id_reserved',"$reserved"); }                if ($namecheck eq $reservecheck) { &fatal_error('id_reserved',"$reserved"); }
           } else {            } else {
               if ($namecheck =~ $reservecheck) { &fatal_error('id_reserved',"$reserved"); }                if ($namecheck =~ $reservecheck) { &fatal_error('id_reserved',"$reserved"); }
           }            }
       }        }
       if ($matchname) {        if ($matchname) {
           if ($matchword) {            if ($matchword) {
               if ($realnamecheck eq $reservecheck) { &fatal_error('name_reserved',"$reserved"); }                if ($realnamecheck eq $reservecheck) { &fatal_error('name_reserved',"$reserved"); }
           } else {            } else {
               if ($realnamecheck =~ $reservecheck) { &fatal_error('name_reserved',"$reserved"); }                if ($realnamecheck =~ $reservecheck) { &fatal_error('name_reserved',"$reserved"); }
           }            }
       }        }
   }    }
   
   if ($default_template) { $new_template = $default_template; }    if ($default_template) { $new_template = $default_template; }
   else { $new_template = qq~Forum default~; }    else { $new_template = qq~Forum default~; }
   
   # check if user isn't already registered    # check if user isn't already registered
   &fatal_error("id_taken") if (-e ("$memberdir/$member{'regusername'}.vars"));    &fatal_error("id_taken") if (-e ("$memberdir/$member{'regusername'}.vars"));
   # check if user isn't already in pre-registration    # check if user isn't already in pre-registration
   &fatal_error("already_preregged") if (-e ("$memberdir/$member{'regusername'}.pre"));    &fatal_error("already_preregged") if (-e ("$memberdir/$member{'regusername'}.pre"));
   &fatal_error("already_preregged") if (-e ("$memberdir/$member{'regusername'}.wait"));    &fatal_error("already_preregged") if (-e ("$memberdir/$member{'regusername'}.wait"));
   
   if ($new_template !~ m^\A[0-9a-zA-Z\_\(\)\ \#\%\-\:\+\?\$\&\~\.\,\@]+\Z^ && $new_template ne '') { &fatal_error('invalid_template'); }    if ($new_template !~ m^\A[0-9a-zA-Z\_\(\)\ \#\%\-\:\+\?\$\&\~\.\,\@]+\Z^ && $new_template ne '') { &fatal_error('invalid_template'); }
   if ($member{'language'} !~ m^\A[0-9a-zA-Z\_\(\)\ \#\%\-\:\+\?\$\&\~\.\,\@]+\Z^ && $member{'language'} ne '') { &fatal_error('invalid_language'); }    if ($member{'language'} !~ m^\A[0-9a-zA-Z\_\(\)\ \#\%\-\:\+\?\$\&\~\.\,\@]+\Z^ && $member{'language'} ne '') { &fatal_error('invalid_language'); }
   
   &ToHTML($member{'language'});    &ToHTML($member{'language'});
   
   $reguser = $member{'regusername'};    $reguser = $member{'regusername'};
   $registerdate = &timetostring($date);    $registerdate = &timetostring($date);
   $language = $member{'language'};    $language = $member{'language'};
   
   &ToHTML($member{'regrealname'});    &ToHTML($member{'regrealname'});
   
   if ($birthday_on_reg) {    if ($birthday_on_reg) {
       $member{'birth_month'} =~ s/\D//g;        $member{'birth_month'} =~ s/\D//g;
       $member{'birth_day'} =~ s/\D//g;        $member{'birth_day'} =~ s/\D//g;
       $member{'birth_year'} =~ s/\D//g;        $member{'birth_year'} =~ s/\D//g;
       if ($birthday_on_reg == 1) {        if ($birthday_on_reg == 1) {
           $member{'birth_month'} = '' if length($member{'birth_month'}) < 2 || $member{'birth_month'} < 1 || $member{'birth_month'} > 12;            $member{'birth_month'} = '' if length($member{'birth_month'}) < 2 || $member{'birth_month'} < 1 || $member{'birth_month'} > 12;
           $member{'birth_day'} = '' if length($member{'birth_day'}) < 2 || $member{'birth_day'} < 1 || $member{'birth_day'} > 31;            $member{'birth_day'} = '' if length($member{'birth_day'}) < 2 || $member{'birth_day'} < 1 || $member{'birth_day'} > 31;
           $member{'birth_year'} = '' if length($member{'birth_year'}) < 4 || $member{'birth_year'} < ($year - 120) || $member{'birth_year'} > $year;            $member{'birth_year'} = '' if length($member{'birth_year'}) < 4 || $member{'birth_year'} < ($year - 120) || $member{'birth_year'} > $year;
           if ($member{'birth_day'} && $member{'birth_month'} && $member{'birth_year'}) { ${$uid.$reguser}{'bday'} = "$member{'birth_month'}/$member{'birth_day'}/$member{'birth_year'}"; }            if ($member{'birth_day'} && $member{'birth_month'} && $member{'birth_year'}) { ${$uid.$reguser}{'bday'} = "$member{'birth_month'}/$member{'birth_day'}/$member{'birth_year'}"; }
   
       } elsif ($birthday_on_reg == 2) {        } elsif ($birthday_on_reg == 2) {
           &fatal_error("",$register_txt{'error_birth_month'}) if length($member{'birth_month'}) < 2 || $member{'birth_month'} < 1 || $member{'birth_month'} > 12;            &fatal_error("",$register_txt{'error_birth_month'}) if length($member{'birth_month'}) < 2 || $member{'birth_month'} < 1 || $member{'birth_month'} > 12;
           &fatal_error("",$register_txt{'error_birth_day'}) if length($member{'birth_day'}) < 2 || $member{'birth_day'} < 1 || $member{'birth_day'} > 31;            &fatal_error("",$register_txt{'error_birth_day'}) if length($member{'birth_day'}) < 2 || $member{'birth_day'} < 1 || $member{'birth_day'} > 31;
           &fatal_error("",$register_txt{'error_birth_year'}) if length($member{'birth_year'}) < 4;            &fatal_error("",$register_txt{'error_birth_year'}) if length($member{'birth_year'}) < 4;
           &fatal_error("",$register_txt{'error_birth_year_real'}) if $member{'birth_year'} < ($year - 120) || $member{'birth_year'} > $year;            &fatal_error("",$register_txt{'error_birth_year_real'}) if $member{'birth_year'} < ($year - 120) || $member{'birth_year'} > $year;
           ${$uid.$reguser}{'bday'} = "$member{'birth_month'}/$member{'birth_day'}/$member{'birth_year'}";            ${$uid.$reguser}{'bday'} = "$member{'birth_month'}/$member{'birth_day'}/$member{'birth_year'}";
       }        }
   }    }
   if ($gender_on_reg) {    if ($gender_on_reg) {
       ${$uid.$reguser}{'gender'} = $member{'gender'};        ${$uid.$reguser}{'gender'} = $member{'gender'};
   }    }
   
   ${$uid.$reguser}{'password'} = &encode_password($member{'passwrd1'});    ${$uid.$reguser}{'password'} = &encode_password($member{'passwrd1'});
   ${$uid.$reguser}{'realname'} = $member{'regrealname'};    ${$uid.$reguser}{'realname'} = $member{'regrealname'};
   ${$uid.$reguser}{'email'} = lc($member{'email'});    ${$uid.$reguser}{'email'} = lc($member{'email'});
   ${$uid.$reguser}{'postcount'} = 0;    ${$uid.$reguser}{'postcount'} = 0;
   ${$uid.$reguser}{'regreason'} = $member{'reason'};    ${$uid.$reguser}{'regreason'} = $member{'reason'};
   ${$uid.$reguser}{'usertext'} = $defaultusertxt;    ${$uid.$reguser}{'usertext'} = $defaultusertxt;
   ${$uid.$reguser}{'userpic'} = "blank.gif";    ${$uid.$reguser}{'userpic'} = "blank.gif";
   ${$uid.$reguser}{'regdate'} = $registerdate;    ${$uid.$reguser}{'regdate'} = $registerdate;
   ${$uid.$reguser}{'regtime'} = $date;    ${$uid.$reguser}{'regtime'} = $date;
   ${$uid.$reguser}{'timeselect'} = $timeselected;    ${$uid.$reguser}{'timeselect'} = $timeselected;
   ${$uid.$reguser}{'timeoffset'} = $timeoffset;    ${$uid.$reguser}{'timeoffset'} = $timeoffset;
   ${$uid.$reguser}{'dsttimeoffset'} = $dstoffset;    ${$uid.$reguser}{'dsttimeoffset'} = $dstoffset;
   ${$uid.$reguser}{'lastips'} = $user_ip;    ${$uid.$reguser}{'lastips'} = $user_ip;
   ${$uid.$reguser}{'hidemail'} = $member{'hideemail'} ? 1 : 0;    ${$uid.$reguser}{'hidemail'} = $member{'hideemail'} ? 1 : 0;
   ${$uid.$reguser}{'timeformat'} = qq~MM D+ YYYY @ HH:mm:ss*~;    ${$uid.$reguser}{'timeformat'} = qq~MM D+ YYYY @ HH:mm:ss*~;
   ${$uid.$reguser}{'template'} = $new_template;    ${$uid.$reguser}{'template'} = $new_template;
   ${$uid.$reguser}{'language'} = $language;    ${$uid.$reguser}{'language'} = $language;
   ${$uid.$reguser}{'pageindex'} = qq~1|1|1|1~;    ${$uid.$reguser}{'pageindex'} = qq~1|1|1|1~;
   if (($addmemgroup_enabled == 1 || $addmemgroup_enabled == 3) && $member{'joinmemgroup'} ne '') {    if (($addmemgroup_enabled == 1 || $addmemgroup_enabled == 3) && $member{'joinmemgroup'} ne '') {
       my @newmemgr;        my @newmemgr;
       foreach (split(/, /, $member{'joinmemgroup'})) {        foreach (split(/, /, $member{'joinmemgroup'})) {
           if ($NoPost{$_} && (split /\|/, $NoPost{$_})[10] == 1) { push(@newmemgr, $_); }            if ($NoPost{$_} && (split /\|/, $NoPost{$_})[10] == 1) { push(@newmemgr, $_); }
       }        }
       ${$uid.$reguser}{'addgroups'} = join(',', @newmemgr);        ${$uid.$reguser}{'addgroups'} = join(',', @newmemgr);
   }    }
   
   if ($regtype == 1 || $regtype == 2) {    if ($regtype == 1 || $regtype == 2) {
       my (@reglist,@x);        my (@reglist,@x);
       # 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);
       }        }
       # If a approve-registration list exists load it too        # If a approve-registration list exists load it too
       if (-e "$memberdir/memberlist.approve") {        if (-e "$memberdir/memberlist.approve") {
           fopen(APPROVE, "$memberdir/memberlist.approve");            fopen(APPROVE, "$memberdir/memberlist.approve");
           push(@reglist, <APPROVE>);            push(@reglist, <APPROVE>);
           fclose(APPROVE);            fclose(APPROVE);
       }        }
       foreach (@reglist) {        foreach (@reglist) {
           @x = split(/\|/, $_);            @x = split(/\|/, $_);
           if ($reguser eq $x[2]) { &fatal_error("already_preregged"); }            if ($reguser eq $x[2]) { &fatal_error("already_preregged"); }
           if (lc $member{'email'} eq lc $x[4]) { &fatal_error("email_already_preregged"); }            if (lc $member{'email'} eq lc $x[4]) { &fatal_error("email_already_preregged"); }
       }        }
   
       # create pre-registration .pre file and write log and inactive list        # create pre-registration .pre file and write log and inactive list
       require "$sourcedir/Decoder.pl";        require "$sourcedir/Decoder.pl";
       &validation_code;        &validation_code;
       $activationcode = substr($sessionid, 0, 20);        $activationcode = substr($sessionid, 0, 20);
   
       if ($extendedprofiles) {        if ($extendedprofiles) {
           require "$sourcedir/ExtendedProfiles.pl";            require "$sourcedir/ExtendedProfiles.pl";
           my $error = &ext_validate_submition($reguser,$reguser);            my $error = &ext_validate_submition($reguser,$reguser);
           if ($error ne "") { &fatal_error("extended_profiles_validation",$error); }            if ($error ne "") { &fatal_error("extended_profiles_validation",$error); }
           &ext_saveprofile($reguser);            &ext_saveprofile($reguser);
       }        }
   
       &UserAccount($reguser, "preregister");        &UserAccount($reguser, "preregister");
       if ($do_scramble_id) { $cryptuser = &cloak($reguser); } else { $cryptuser = $reguser; }        if ($do_scramble_id) { $cryptuser = &cloak($reguser); } else { $cryptuser = $reguser; }
         $regpass = encode_password($member{'passwrd1'});          $regpass = encode_password($member{'passwrd1'});
         fopen(INACT, ">>$memberdir/memberlist.inactive", 1);          fopen(INACT, ">>$memberdir/memberlist.inactive", 1);
       print INACT "$date|$activationcode|$reguser|$regpass|$member{'email'}|$user_ip\n";        print INACT "$date|$activationcode|$reguser|$regpass|$member{'email'}|$user_ip\n";
       fclose(INACT);        fclose(INACT);
       fopen(REGLOG, ">>$vardir/registration.log", 1);        fopen(REGLOG, ">>$vardir/registration.log", 1);
       print REGLOG "$date|N|$member{'regusername'}||$user_ip\n";        print REGLOG "$date|N|$member{'regusername'}||$user_ip\n";
       fclose(REGLOG);        fclose(REGLOG);
   
       ## send an e-mail to the user that registration is pending e-mail validation within the given timespan. ##        ## send an e-mail to the user that registration is pending e-mail validation within the given timespan. ##
       my $templanguage = $language;        my $templanguage = $language;
       $language = $member{'language'};        $language = $member{'language'};
       &LoadLanguage('Email');        &LoadLanguage('Email');
       &sendmail(${$uid.$reguser}{'email'}, "$mailreg_txt{'apr_result_activate'} $mbname", &template_email($preregemail, {'displayname' => $member{'regrealname'}, 'username' => $reguser, 'cryptusername' => $cryptuser, 'password' => $member{'passwrd1'}, 'activationcode' => $activationcode, 'preregspan' => $preregspan}),'',$emailcharset);        &sendmail(${$uid.$reguser}{'email'}, "$mailreg_txt{'apr_result_activate'} $mbname", &template_email($preregemail, {'displayname' => $member{'regrealname'}, 'username' => $reguser, 'cryptusername' => $cryptuser, 'password' => $member{'passwrd1'}, 'activationcode' => $activationcode, 'preregspan' => $preregspan}),'',$emailcharset);
       $language = $templanguage;        $language = $templanguage;
       $yymain .= qq~        $yymain .= qq~
           <div class="bordercolor" style="width: 650px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">            <div class="bordercolor" style="width: 650px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">
               <div class="bordercolor" style="width: 650px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">                <div class="bordercolor" style="width: 650px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">
                   <table cellpadding="4" cellspacing="1" border="0" width="100%" align="center">                    <table cellpadding="4" cellspacing="1" border="0" width="100%" align="center">
                       <tr><td class="titlebg"><img src="$imagesdir/register.gif" alt="$prereg_txt{'1a'}" title="$prereg_txt{'1a'}" border="0" /><b>$prereg_txt{'1a'}</b></td></tr>                        <tr><td class="titlebg"><img src="$imagesdir/register.gif" alt="$prereg_txt{'1a'}" title="$prereg_txt{'1a'}" border="0" /><b>$prereg_txt{'1a'}</b></td></tr>
                       <tr><td class="windowbg" align="left">$prereg_txt{'1'}</td></tr>                        <tr><td class="windowbg" align="left">$prereg_txt{'1'}</td></tr>
                   </table>                    </table>
               </div>                </div>
           </div>~;            </div>~;
       $yytitle = "$prereg_txt{'1a'}";        $yytitle = "$prereg_txt{'1a'}";
   
   } else {    } else {
       if ($extendedprofiles) {        if ($extendedprofiles) {
           require "$sourcedir/ExtendedProfiles.pl";            require "$sourcedir/ExtendedProfiles.pl";
           my $error = &ext_validate_submition($reguser,$reguser);            my $error = &ext_validate_submition($reguser,$reguser);
           if ($error ne "") { &fatal_error("extended_profiles_validation",$error); }            if ($error ne "") { &fatal_error("extended_profiles_validation",$error); }
           &ext_saveprofile($reguser);            &ext_saveprofile($reguser);
       }        }
       &UserAccount($reguser, "register");        &UserAccount($reguser, "register");
       &MemberIndex("add", $reguser);        &MemberIndex("add", $reguser);
       &FormatUserName($reguser);        &FormatUserName($reguser);
   
       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(IM, ">$memberdir/$member{'regusername'}.msg", 1);            fopen(IM, ">$memberdir/$member{'regusername'}.msg", 1);
           print IM "$messageid|$sendname|$member{'regusername'}|||$imsubject|$date|$imtext|$messageid|0|$ENV{'REMOTE_ADDR'}|s|u||\n";            print IM "$messageid|$sendname|$member{'regusername'}|||$imsubject|$date|$imtext|$messageid|0|$ENV{'REMOTE_ADDR'}|s|u||\n";
           fclose(IM);            fclose(IM);
       }        }
       if ($new_member_notification) {        if ($new_member_notification) {
           my $templanguage = $language;            my $templanguage = $language;
           $language = $lang;            $language = $lang;
           &LoadLanguage('Email');            &LoadLanguage('Email');
           &sendmail($new_member_notification_mail, $mailreg_txt{'new_member_info'}, &template_email($newmemberemail, {'displayname' => $member{'regrealname'}, 'username' => $reguser, 'userip' => $user_ip, 'useremail' => ${$uid.$reguser}{'email'}}),'',$emailcharset);            &sendmail($new_member_notification_mail, $mailreg_txt{'new_member_info'}, &template_email($newmemberemail, {'displayname' => $member{'regrealname'}, 'username' => $reguser, 'userip' => $user_ip, 'useremail' => ${$uid.$reguser}{'email'}}),'',$emailcharset);
           $language = $templanguage;            $language = $templanguage;
       }        }
   
       if ($emailpassword) {        if ($emailpassword) {
           my $templanguage = $language;            my $templanguage = $language;
           $language = $member{'language'};            $language = $member{'language'};
           &LoadLanguage('Email');            &LoadLanguage('Email');
           &sendmail(${$uid.$reguser}{'email'}, "$mailreg_txt{'apr_result_info'} $mbname", &template_email($passwordregemail, {'displayname' => $member{'regrealname'}, 'username' => $reguser, 'password' => $member{'passwrd1'}}),'',$emailcharset);            &sendmail(${$uid.$reguser}{'email'}, "$mailreg_txt{'apr_result_info'} $mbname", &template_email($passwordregemail, {'displayname' => $member{'regrealname'}, 'username' => $reguser, 'password' => $member{'passwrd1'}}),'',$emailcharset);
           $language = $templanguage;            $language = $templanguage;
           $yymain .= qq~            $yymain .= qq~
<div class="bordercolor" style="width: 650px; margin-bottom: 8px; margin-left: auto; margin-right: auto;"> <div class="bordercolor" style="width: 650px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">