3 * Register new acoount page
5 * Copyright 1999-2001 (c) VA Linux Systems
7 * This file is part of GForge.
9 * GForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * GForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 require_once('../env.inc.php');
25 require_once $gfwww.'include/pre.php';
26 require_once $gfcommon.'include/account.php';
27 require_once $gfcommon.'include/timezones.php';
29 if ($sys_user_reg_restricted) {
30 session_require(array('group'=>'1','admin_flags'=>'A'));
33 $unix_name = getStringFromRequest('unix_name');
34 $firstname = getStringFromRequest('firstname');
35 $lastname = getStringFromRequest('lastname');
36 $password1 = getStringFromRequest('password1');
37 $password2 = getStringFromRequest('password2');
38 $email = getStringFromRequest('email');
39 $mail_site = getStringFromRequest('mail_site');
40 $mail_va = getStringFromRequest('mail_va');
41 $language_id = getIntFromRequest('language_id');
42 $timezone = getStringFromRequest('timezone');
43 $jabber_address = getStringFromRequest('jabber_address');
44 $jabber_only = getStringFromRequest('jabber_only');
45 $theme_id = getIntFromRequest('theme_id');
46 $address = getStringFromRequest('address');
47 $address2 = getStringFromRequest('address2');
48 $phone = getStringFromRequest('phone');
49 $fax = getStringFromRequest('fax');
50 $title = getStringFromRequest('title');
51 $ccode = getStringFromRequest('ccode');
53 if ($sys_use_ssl && !session_issecure()) {
54 //force use of SSL for login
55 header('Location: https://'.getStringFromServer('HTTP_HOST').getStringFromServer('REQUEST_URI'));
58 if (!$theme_id || !is_numeric($theme_id)) {
59 $theme_id=$HTML->getThemeIdFromName($sys_theme);
62 if (getStringFromRequest('submit')) {
64 Adding call to library rather than
65 logic that used to be coded in this page
67 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
68 exit_form_double_submit();
70 $new_user = new GFUser();
71 $register = $new_user->create($unix_name,$firstname,$lastname,$password1,$password2,
72 $email,$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,$theme_id,'',
73 $address,$address2,$phone,$fax,$title,$ccode);
75 echo $HTML->header(array('title'=>'Register Confirmation'));
77 printf(_('<p>Congratulations. You have registered on %1$s. <p> You are now being sent a confirmation email to verify your email address. Visiting the link sent to you in this email will activate your account.'), $sys_name);
78 echo $HTML->footer(array());
81 $feedback = $new_user->getErrorMessage();
85 $HTML->header(array('title'=>'User Account Registration'));
87 if (isset($feedback)) {
88 print "<p><span class=\"error\">$feedback $register_error</span>";
90 if (!isset($timezone) || empty($timezone) || !eregi('^[-a-z0-9_/]*?$', $timezone)) {
91 $timezone = (isset($sys_default_timezone) ? $sys_default_timezone : 'GMT');
93 if (!isset($ccode) || empty($ccode) || !eregi('^[a-z][a-z]$', $ccode)) {
94 $ccode = $sys_default_country_code;
98 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
99 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
101 <?php echo _('Login Name (do not use uppercase letters):'); echo utils_requiredField(); ?><br />
102 <input type="text" name="unix_name" value="<?php print(htmlspecialchars(stripslashes($unix_name))); ?>" />
105 <?php echo _('Password (min. 6 chars):'); echo utils_requiredField(); ?><br />
106 <input type="password" name="password1" />
109 <?php echo _('Password (repeat):'); echo utils_requiredField(); ?><br />
110 <input type="password" name="password2" />
113 <?php echo _('Title:'); ?><br />
114 <input type="text" name="title" value="<?php echo htmlspecialchars(stripslashes($title)); ?>" size="10" />
117 <?php echo _('First Name:'); echo utils_requiredField(); ?><br />
118 <input size="30" type="text" name="firstname" value="<?php print(htmlspecialchars(stripslashes($firstname))); ?>" />
121 <?php echo _('Last Name:'); echo utils_requiredField(); ?><br />
122 <input size="30" type="text" name="lastname" value="<?php print(htmlspecialchars(stripslashes($lastname))); ?>" />
125 <?php echo _('Language Choice:'); ?><br />
126 <?php echo html_get_language_popup ('language_id', language_name_to_lang_id (choose_language_from_context ())); ?>
129 <?php echo _('Timezone:'); ?><br />
130 <?php echo html_get_timezone_popup('timezone', $timezone); ?>
133 <?php echo _('Theme'); ?><br />
134 <?php echo html_get_theme_popup('theme_id', $theme_id); ?>
137 <?php echo _('Country:'); ?><br />
138 <?php echo html_get_ccode_popup('ccode', $ccode); ?>
141 @<?php printf(_('Email Address:<span class="important">*</span><br /><em>This email address will be verified before account activation. You will receive a mail forward account at <loginname@%1$s> that will forward to this address.</em>'), $GLOBALS['sys_users_host']); ?>
142 <br /><input size="30" type="text" name="email" value="<?php print(htmlspecialchars(stripslashes($email))); ?>" />
146 if ($sys_use_jabber) {
147 echo _('Jabber Address:').'<br />
148 <input size="30" type="text" name="jabber_address" value="'.
149 htmlspecialchars(stripslashes($jabber_address)) .'" /><br />
150 <input type="checkbox" name="jabber_only" value="1" />
151 '._('Send auto-generated notices only to my Jabber address').'.';
156 <?php echo _('Address:'); ?><br />
157 <input type="text" name="address" value="<?php echo htmlspecialchars(stripslashes($address)); ?>" size="80" />
160 <?php echo _('Address:'); ?><br />
161 <input type="text" name="address2" value="<?php echo htmlspecialchars(stripslashes($address2)); ?>" size="80" />
164 <?php echo _('Phone:'); ?><br />
165 <input type="text" name="phone" value="<?php echo htmlspecialchars(stripslashes($phone)); ?>" size="20" />
168 <?php echo _('FAX:'); ?><br />
169 <input type="text" name="fax" value="<?php echo htmlspecialchars(stripslashes($fax)); ?>" size="20" />
172 <input type="checkbox" name="mail_site" value="1" checked="checked" />
173 <?php echo _('Receive Email about Site Updates <i>(Very low traffic and includes security notices. Highly Recommended.)</i>'); ?>
176 <input type="checkbox" name="mail_va" value="1" />
177 <?php echo _('Receive additional community mailings. <i>(Low traffic.)</i>'); ?>
180 <?php printf(_('Fields marked with %s are mandatory.'), utils_requiredField()); ?>
183 <input type="submit" name="submit" value="<?php echo _('Register'); ?>" />
186 <p><a href="pending-resend.php"><?php echo _('[Resend confirmation email to a pending account]'); ?></a></p>
188 <?php $HTML->footer(array());
192 // c-file-style: "bsd"