###############################################################################
# CP_CreateAccount.src                                                        #
###############################################################################
# UltraBoard 2000 by UltraScripts.com, Inc.                                   #
# Scripts written by Jacky Wing Wa Yung, WebMaster@UltraScripts.com           #
# Available from http://www.UltraBoard.org/                                   #
# =========================================================================== #
# COPYRIGHT NOTICE :                                                          #
#                                                                             #
# Copyright (c) 1999-2000 UltraScripts.com, Inc. All Rights Reserved.         #
#                                                                             #
# This program is being distributed as shareware. It may be used and modified #
# free for personal, government or non-profit. Any commercial use must be     #
# registered. However, modified versions cannot be sold or distributed. You   #
# cannot alter the copyright and "powered by" notices throughout the scripts. #
# These notices must be clearly visible to the end users.                     #
#                                                                             #
# WARRANTY DISCLAIMER:                                                        #
#                                                                             #
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT #
# ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR       #
# FITNESS FOR A PARTICULAR PURPOSE.                                           #
###############################################################################

package Source;

sub CreateAccount {
  my ($ERROR) = @_;

  (
    my ($DB) = &DB::Query (
      TABLE   => "Groups",
      COLUMNS => ["ID", "TITLE"]
    )
  ) || &HTML::Error("Members Accounts Management / Create a new member account", "No group available for you to choose yet.<br>Sorry, you have to <a href=\"$SYSTEM::CP_URL/Panel.$SYSTEM::EXT?action=CreateGroup\" target=\"UBBODY\">create a new member group</a> first!");

  my $Groups;
  for (my $i = 0; $i <= $#{ $DB }; $i++) {
    push (
      @{ $Groups },
      {
        KEY   => $DB->[$i]{'ID'},
        VALUE => $DB->[$i]{'TITLE'}
      }
    );
  }

  my $Level = [
    {
      KEY   => "30",
      VALUE => $GENERAL::MEMBER_LEVEL_30,
    }, {
      KEY   => "50",
      VALUE => $GENERAL::MEMBER_LEVEL_50,
    }, {
      KEY   => "70",
      VALUE => $GENERAL::MEMBER_LEVEL_70,
    }
  ];

  my %FORM;
  $FORM{'FORM_USERNAME'}  = $UB::QUERY{'FORM_USERNAME'};
  $FORM{'FORM_NICKNAME'}  = $UB::QUERY{'FORM_NICKNAME'};
  $FORM{'FORM_PASSWORD'}  = $UB::QUERY{'FORM_PASSWORD'};
  $FORM{'FORM_EMAIL'}     = $UB::QUERY{'FORM_EMAIL'};

  $FORM{'FORM_LEVEL'}     = &HTML::Select (
    NAME      => "FORM_LEVEL",
    VALUE     => $Level      ,
    SELECTED  => [$UB::QUERY{'FORM_LEVEL'}],
    EXTRA     => "style=\"width:100%\""
  );
  $FORM{'FORM_GROUP'}     = &HTML::Select (
    NAME      => "FORM_GROUP",
    VALUE     => $Groups     ,
    SELECTED  => [$UB::CGI->param('FORM_GROUP')],
    EXTRA     => "style=\"width:100%\""
  );

  $FORM{'FORM_STATUS-50'} = &HTML::Radio (
    NAME    => "FORM_STATUS",
    VALUE   => "50"         ,
    CHECKED => $UB::QUERY{'FORM_STATUS'} || 50
  );
  $FORM{'FORM_STATUS-30'} = &HTML::Radio (
    NAME    => "FORM_STATUS",
    VALUE   => "30"         ,
    CHECKED => $UB::QUERY{'FORM_STATUS'} || 50
  );

  &Standard::PrintHTMLHeader();
  print &HTML::Header;
  print<<HTML;
<form action="$SYSTEM::CP_URL/Panel.$SYSTEM::EXT" method="post">
<input type="hidden" name="action" value="DoCreateAccount">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr bgcolor="Gray">
    <td><font color="White"><b>
      <a href="$SYSTEM::CP_URL/Panel.$SYSTEM::EXT?action=body" target="UBBODY" class="address">Control Panel</a> / Members Accounts Management / Create a new member account
    </b></font></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="2">
        <tr>
          <td>
            <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolordark="White" bordercolorlight="Gray">
              <tr>
                <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="2">
                    <tr>
                      <td>
HTML

  if ($ERROR ne "") {
    print<<HTML;
                        There were the following errors during creating member account.<br>
                        <table width="100%" border="0" cellspacing="2" cellpadding="2">
                          <tr>
                            <td><font color="#FF0000">$ERROR</font></td>
                          </tr>
                        </table>
                        Please make any changes and try again!<br>
HTML
  }

print<<HTML;
                      Please fill out all required (<font color="Red"><b>*</b></font>) fields.
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            &nbsp;<br>
            &nbsp;&nbsp;General Information
            <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolordark="White" bordercolorlight="Gray">
              <tr>
                <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="2">
                    <tr>
                      <td width="100" valign="top" nowrap>Username <font color="Red"><b>*</b></font></td>
                      <td width="100%"><input type="text" name="FORM_USERNAME" value="$FORM{'FORM_USERNAME'}" size="45" maxlength="16" style="width:100%"></td>
                      <td width="20" valign="top" nowrap><img src="$SYSTEM::IMAGE_URL/help.gif" width=20 height=20 border=0 alt="enter a username for your member to login use. (16 chars. max.)"></td>
                    </tr>
                    <tr>
                      <td width="100" valign="top" nowrap>Nickname <font color="Red"><b>*</b></font></td>
                      <td width="100%"><input type="text" name="FORM_NICKNAME" value="$FORM{'FORM_NICKNAME'}" size="45" maxlength="32" style="width:100%"></td>
                      <td width="20" valign="top" nowrap><img src="$SYSTEM::IMAGE_URL/help.gif" width=20 height=20 border=0 alt="enter a nickname for your member. (32 chars. max.)"></td>
                    </tr>
                    <tr>
                      <td width="100" valign="top" nowrap>Password <font color="Red"><b>*</b></font></td>
                      <td width="100%"><input type="text" name="FORM_PASSWORD" value="$FORM{'FORM_PASSWORD'}" size="45" maxlength="16" style="width:100%"></td>
                      <td width="20" valign="top" nowrap><img src="$SYSTEM::IMAGE_URL/help.gif" width=20 height=20 border=0 alt="enter a password for your member. (16 chars. max.)"></td>
                    </tr>
                    <tr>
                      <td width="100" valign="top" nowrap>Level <font color="Red"><b>*</b></font></td>
                      <td width="100%">$FORM{'FORM_LEVEL'}</td>
                      <td width="20" valign="top" nowrap><img src="$SYSTEM::IMAGE_URL/help.gif" width=20 height=20 border=0 alt="choose a level for your member.\n\npremium members may become moderators.\n\nteam members have full access as administrator except configure system permsision."></td>
                    </tr>
                    <tr>
                      <td width="100" valign="top" nowrap>Member Group <font color="Red"><b>*</b></font></td>
                      <td width="100%">$FORM{'FORM_GROUP'}</td>
                      <td width="20" valign="top" nowrap><img src="$SYSTEM::IMAGE_URL/help.gif" width=20 height=20 border=0 alt="choose a member group for your member. it may help you organize your members easily."></td>
                    </tr>
                    <tr>
                      <td width="100" valign="top" nowrap>Email <font color="Red"><b>*</b></font></td>
                      <td width="100%"><input type="text" name="FORM_EMAIL" value="$FORM{'FORM_EMAIL'}" size="45" maxlength="64" style="width:100%"></td>
                      <td width="20" valign="top" nowrap><img src="$SYSTEM::IMAGE_URL/help.gif" width=20 height=20 border=0 alt="enter the email address of your member."></td>
                    </tr>
                    <tr>
                      <td width="100" valign="top" nowrap>Status</td>
                      <td width="100%">$FORM{'FORM_STATUS-50'}Activated $FORM{'FORM_STATUS-30'}Deactivated</td>
                      <td width="20" valign="top" nowrap><img src="$SYSTEM::IMAGE_URL/help.gif" width=20 height=20 border=0 alt="choose the status of yoru member."></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td align="right"><input type="submit" value="Create it">&nbsp;&nbsp;<input type="Reset" value="Cancel"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>
HTML
}


###############################################################################
1; # end of CP_CreateAccount.src file
###############################################################################