$g_vars['page']['is_new_record'] = empty($arrUserData);
echo '<p><form method=post action="users.php?id=' . ($f_id > 0 ? $f_id : '') . '&action=edit">';
echo '<table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
$i_rowno = 0;
if ($G_SESSION['access_users'] != 1 && $G_SESSION['access_users'] != 3) {
    echo '<tr class=rowtwo valign=top><td colspan=2>' . getCheckbox('user_enabled', isset($arrUserData['user_enabled']) ? $arrUserData['user_enabled'] : true, $lngstr['page_users']['userenabled']) . '</td></tr>';
    $i_rowno = 1;
    writeTR2Fixed($lngstr['page_users']['joindate'], isset($arrUserData['user_joindate']) && $arrUserData['user_joindate'] > 0 ? getDateLocal($lngstr['language']['date_format_full'], $arrUserData['user_joindate']) : '');
    writeTR2Fixed($lngstr['page_users']['logindate'], isset($arrUserData['user_logindate']) && $arrUserData['user_logindate'] > 0 ? getDateLocal($lngstr['language']['date_format_full'], $arrUserData['user_logindate']) : '');
    $strExpireDateFormatted = !empty($arrUserData['user_expiredate']) && $arrUserData['user_expiredate'] > 0 ? getDateLocal($lngstr['language']['calendar']['date_format'], $arrUserData['user_expiredate']) : '';
    $strExpireDate = '<input name="user_expiredate" id="user_expiredate" value="' . $strExpireDateFormatted . '" class=inp type=text size=20><a href="javascript:void(0);" title="' . $lngstr['calendar']['hint'] . '"><img src="images/button-calendar.gif" alt="' . $lngstr['calendar']['hint'] . '" class="calendar-icon" onclick="return showCalendar(\'user_expiredate\', \'' . $lngstr['language']['calendar']['date_format'] . '\', \'24\', true);" onmouseover="this.className+=\' calendar-icon-hover\';" onmouseout="this.className = this.className.replace(/\\s*calendar-icon-hover/ig, \'\');"></a>';
    writeTR2Fixed($lngstr['page_users']['expiredate'], $strExpireDate);
}
writeTR2Fixed($lngstr['page_users']['username'], getInputElement('username', @$arrUserData['username']));
writeTR2Fixed($lngstr['page_users']['password_new'], getPasswordBox('user_password', ''));
writeTR2Fixed($lngstr['page_users']['password_confirm'], getPasswordBox('user_password_confirm', ''));
writeTR2Fixed($lngstr['page_users']['email'], getInputElement('email', @$arrUserData['email']));
writeTR2Fixed($lngstr['page_users']['firstname'], getInputElement('user_firstname', @$arrUserData['user_firstname']));
writeTR2Fixed($lngstr['page_users']['lastname'], getInputElement('user_lastname', @$arrUserData['user_lastname']));
writeTR2Fixed($lngstr['page_users']['middlename'], getInputElement('user_middlename', @$arrUserData['user_middlename']));
if ($G_SESSION['access_users'] != 1 && $G_SESSION['access_users'] != 3) {
    echo '<tr valign=top><td class=rowhdr2 colspan=2><a class=rowhdr2 href="javascript:void(0)" onclick="javascript:toggleSection(\'div_users_groups\')">' . $lngstr['page_users']['section_groups'] . '</td></tr>';
    echo '<tr valign=top><td class=rowone colspan=2><div id=div_users_groups style="display:' . (isset($_COOKIE['div_users_groups']) && $_COOKIE['div_users_groups'] == 'Y' ? 'block' : 'none') . '"><table class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%">';
    $i_groups_text = '';
    $arrUserGroups = array();
    if ($g_vars['page']['is_new_record']) {
        $arrUserGroups = array(DEFAULT_GROUP);
    } else {
        //9917//9917
        $i_rSet2 = $g_db->Execute("SELECT groupid FROM " . $srv_settings['table_prefix'] . "groups_users WHERE id=" . $f_id);
        if (!$i_rSet2) {
        if (!$i_rSet1->EOF) {
            $i_max_id = (int) $i_rSet1->fields['id'];
        }
        $i_rSet1->Close();
    }
    $f_username = getAutoUsername($i_max_id);
}
if (getConfigItem(CONFIG_reg_password) == CONFIG_CONST_show_autogenerate) {
    $f_password = getAutoPassword(IGT_PASSWORD_LENGTH);
    $f_confirmpassword = $f_password;
}
$g_vars['page']['intro'] = getConfigItem(CONFIG_reg_intro);
$i_rowno = 0;
$g_vars['page']['items']['username'] = @getInputField(getConfigItem(CONFIG_reg_username), $lngstr['label_username'], getInputElement('username', $f_username));
$g_vars['page']['items']['password'] = @getInputField(getConfigItem(CONFIG_reg_password), $lngstr['label_password'], getPasswordBox('password', $f_password));
$g_vars['page']['items']['confirmpassword'] = @getInputField(getConfigItem(CONFIG_reg_password), $lngstr['label_confirmpassword'], getPasswordBox('confirmpassword', $f_confirmpassword));
$g_vars['page']['items']['email'] = @getInputField(getConfigItem(CONFIG_reg_email), $lngstr['label_email'], getInputElement('email', $f_email));
$g_vars['page']['items']['title'] = @getInputField(getConfigItem(CONFIG_reg_title), $lngstr['label_title'], getSelectElement('title', $f_title, $lngstr['page-register']['title_items']));
$g_vars['page']['items']['firstname'] = @getInputField(getConfigItem(CONFIG_reg_firstname), $lngstr['label_firstname'], getInputElement('firstname', $f_firstname));
$g_vars['page']['items']['lastname'] = @getInputField(getConfigItem(CONFIG_reg_lastname), $lngstr['label_lastname'], getInputElement('lastname', $f_lastname));
$g_vars['page']['items']['middlename'] = @getInputField(getConfigItem(CONFIG_reg_middlename), $lngstr['label_middlename'], getInputElement('middlename', $f_middlename));
$g_vars['page']['items']['address'] = @getInputField(getConfigItem(CONFIG_reg_address), $lngstr['label_address'], getInputElement('address', $f_address));
$g_vars['page']['items']['city'] = @getInputField(getConfigItem(CONFIG_reg_city), $lngstr['label_city'], getInputElement('city', $f_city));
$g_vars['page']['items']['state'] = @getInputField(getConfigItem(CONFIG_reg_state), $lngstr['label_state'], isset($lngstr['custom']['user_state_items']) ? getSelectElement('state', $f_state, $lngstr['custom']['user_state_items']) : getInputElement('state', $f_state));
$g_vars['page']['items']['zip'] = @getInputField(getConfigItem(CONFIG_reg_zip), $lngstr['label_zip'], getInputElement('zip', $f_zip));
$g_vars['page']['items']['country'] = @getInputField(getConfigItem(CONFIG_reg_country), $lngstr['label_country'], getSelectElement('country', $f_country, $lngstr['label_country_items']));
$g_vars['page']['items']['phone'] = @getInputField(getConfigItem(CONFIG_reg_phone), $lngstr['label_phone'], getInputElement('phone', $f_phone));
$g_vars['page']['items']['fax'] = @getInputField(getConfigItem(CONFIG_reg_fax), $lngstr['label_fax'], getInputElement('fax', $f_fax));
$g_vars['page']['items']['mobile'] = @getInputField(getConfigItem(CONFIG_reg_mobile), $lngstr['label_mobile'], getInputElement('mobile', $f_mobile));
$g_vars['page']['items']['pager'] = @getInputField(getConfigItem(CONFIG_reg_pager), $lngstr['label_pager'], getInputElement('pager', $f_pager));
$g_vars['page']['items']['ipphone'] = @getInputField(getConfigItem(CONFIG_reg_ipphone), $lngstr['label_ipphone'], getInputElement('ipphone', $f_ipphone));