$f_confirmpassword = ''; $f_groupid = (int) readGetVar('groupid', readPostVar('groupid')); if ($f_groupid <= SYSTEM_GROUP_MAX_INDEX) { $f_groupid = DEFAULT_GROUP; } $f_testid = (int) readGetVar('testid', readPostVar('testid')); if (getConfigItem(CONFIG_reg_username) == CONFIG_CONST_show_autogenerate) { $i_max_id = 0; $i_rSet1 = $g_db->SelectLimit("SELECT id FROM " . $srv_settings['table_prefix'] . "users ORDER BY id DESC"); if ($i_rSet1) { 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));
global $g_vars, $srv_settings, $lngstr; if ($i_required && !$i_value) { $g_vars['page']['errors'] .= $lngstr['page_register']['no_' . $i_name]; } } if ($g_vars['page']['errors']) { include_once $DOCUMENT_PAGES . "register-1.inc.php"; } else { $i_id = api_addNewUser($f_username, $f_password, array('email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword, 'active' => false), array($f_groupid)); if ($i_id == false) { $g_vars['page']['errors'] .= $lngstr['err_username_duplicate']; unset($f_username); include_once $DOCUMENT_PAGES . "register-1.inc.php"; } else { if ($i_CONFIG_reg_username == CONFIG_CONST_donotshow_autogenerate || $i_CONFIG_reg_username == CONFIG_CONST_show_autogenerate && getRecordCount($srv_settings['table_prefix'] . 'users', "username="******"UPDATE " . $srv_settings['table_prefix'] . "users SET username="******" WHERE id=" . $i_id); $_POST['username'] = $f_username; } sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_REGISTRATION_INDEX, 'emailto' => array($f_email), 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword)); $i_admin_emails = getRecordItem($srv_settings['table_prefix'] . 'etemplates', 'etemplate_from', 'etemplateid=' . SYSTEM_ETEMPLATES_ACTIVATE_INDEX); $i_admin_emails = explode(SYSTEM_ARRAY_ITEM_SEPARATOR, $i_admin_emails); sendEmailTemplate(array('etemplateid' => SYSTEM_ETEMPLATES_REGISTRATION_INDEX_FOR_ADMIN, 'emailto' => $i_admin_emails, 'id' => $i_id, 'username' => $f_username, 'password' => $f_password, 'email' => $f_email, 'title' => $f_title, 'firstname' => $f_firstname, 'lastname' => $f_lastname, 'middlename' => $f_middlename, 'address' => $f_address, 'city' => $f_city, 'state' => $f_state, 'zip' => $f_zip, 'country' => $f_country, 'phone' => $f_phone, 'fax' => $f_fax, 'mobile' => $f_mobile, 'pager' => $f_pager, 'ipphone' => $f_ipphone, 'webpage' => $f_webpage, 'icq' => $f_icq, 'msn' => $f_msn, 'aol' => $f_aol, 'gender' => $f_gender, 'birthday' => $f_birthday, 'husbandwife' => $f_husbandwife, 'children' => $f_children, 'trainer' => $f_trainer, 'photo' => $f_photo, 'company' => $f_company, 'cposition' => $f_cposition, 'department' => $f_department, 'coffice' => $f_coffice, 'caddress' => $f_caddress, 'ccity' => $f_ccity, 'cstate' => $f_cstate, 'czip' => $f_czip, 'ccountry' => $f_ccountry, 'cphone' => $f_cphone, 'cfax' => $f_cfax, 'cmobile' => $f_cmobile, 'cpager' => $f_cpager, 'cipphone' => $f_cipphone, 'cwebpage' => $f_cwebpage, 'cphoto' => $f_cphoto, 'ufield1' => $f_userfield1, 'ufield2' => $f_userfield2, 'ufield3' => $f_userfield3, 'ufield4' => $f_userfield4, 'ufield5' => $f_userfield5, 'ufield6' => $f_userfield6, 'ufield7' => $f_userfield7, 'ufield8' => $f_userfield8, 'ufield9' => $f_userfield9, 'ufield10' => $f_userfield10, 'checkword' => $i_checkword)); switch (getConfigItem(CONFIG_upon_registration)) { case CONFIG_CONST_upon_registration_signinautomatically: activateUserByID($i_id, true); signinUser($f_username, $f_password, false); if ($f_testid > 0) { gotoLocation('test.php?testid=' . $f_testid); } else { gotoLocation('index.php');