3 * Register new account 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 (forge_get_config ('user_registration_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 = getIntFromRequest('mail_site');
40 $mail_va = getIntFromRequest('mail_va');
42 $language_id = getIntFromRequest('language_id');
43 $timezone = getStringFromRequest('timezone');
44 $jabber_address = getStringFromRequest('jabber_address');
45 $jabber_only = getStringFromRequest('jabber_only');
46 $theme_id = getIntFromRequest('theme_id');
47 $address = getStringFromRequest('address');
48 $address2 = getStringFromRequest('address2');
49 $phone = getStringFromRequest('phone');
50 $fax = getStringFromRequest('fax');
51 $title = getStringFromRequest('title');
52 $ccode = getStringFromRequest('ccode');
53 $accept_conditions = getIntFromRequest ('accept_conditions');
55 if ($sys_use_ssl && !session_issecure()) {
56 //force use of SSL for login
57 header('Location: https://'.getStringFromServer('HTTP_HOST').getStringFromServer('REQUEST_URI'));
60 if (!$theme_id || !is_numeric($theme_id)) {
61 $theme_id=$HTML->getThemeIdFromName($sys_theme);
64 if (getStringFromRequest('submit')) {
66 Adding call to library rather than
67 logic that used to be coded in this page
69 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
70 exit_form_double_submit();
73 if ($GLOBALS['sys_require_accept_conditions'] && ! $accept_conditions) {
74 $feedback = _("You can't register an account unless you accept the terms of use.") ;
76 $new_user = new GFUser();
77 $register = $new_user->create($unix_name,$firstname,$lastname,$password1,$password2,
78 $email,$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,$theme_id,'',
79 $address,$address2,$phone,$fax,$title,$ccode);
81 echo $HTML->header(array('title'=>'Register Confirmation'));
83 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.'), forge_get_config ('forge_name'));
84 echo $HTML->footer(array());
87 $feedback = $new_user->getErrorMessage();
92 $HTML->header(array('title'=>'User Account Registration'));
94 if (isset($feedback)) {
96 print "<div class=\"error\">$feedback";
98 if (isset($register_error)) {
99 print " $register_error";
104 if (!isset($timezone) || empty($timezone) || !preg_match('/^[-a-zA-Z0-9_\/\.+]+$/', $timezone)) {
105 $timezone = (isset($sys_default_timezone) ? $sys_default_timezone : 'GMT');
107 if (!isset($ccode) || empty($ccode) || !preg_match('/^[a-zA-Z]{2}$/', $ccode)) {
108 $ccode = $sys_default_country_code;
112 <form action="<?php echo util_make_url('/account/register.php'); ?>" method="post">
113 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
116 if ($GLOBALS['sys_require_unique_email']) {
117 echo _('Login Name (no uppercase letters; leave empty to have it generated automatically):');
119 echo _('Login Name (do not use uppercase letters):'); echo utils_requiredField();
121 <input type="text" name="unix_name" value="<?php print(htmlspecialchars(stripslashes($unix_name))); ?>" />
124 <?php echo _('Password (min. 6 chars):'); echo utils_requiredField(); ?><br />
125 <input type="password" name="password1" />
128 <?php echo _('Password (repeat):'); echo utils_requiredField(); ?><br />
129 <input type="password" name="password2" />
132 <?php echo _('Title:'); ?><br />
133 <input type="text" name="title" value="<?php echo htmlspecialchars($title); ?>" size="10" />
136 <?php echo _('First Name:'); echo utils_requiredField(); ?><br />
137 <input size="30" type="text" name="firstname" value="<?php print(htmlspecialchars($firstname)); ?>" />
140 <?php echo _('Last Name:'); echo utils_requiredField(); ?><br />
141 <input size="30" type="text" name="lastname" value="<?php print(htmlspecialchars($lastname)); ?>" />
144 <?php echo _('Language Choice:'); ?><br />
145 <?php echo html_get_language_popup ('language_id', language_name_to_lang_id (choose_language_from_context ())); ?>
148 <?php echo _('Timezone:'); ?><br />
149 <?php echo html_get_timezone_popup('timezone', $timezone); ?>
152 <?php echo _('Theme'); ?><br />
153 <?php echo html_get_theme_popup('theme_id', $theme_id); ?>
156 <?php echo _('Country:'); ?><br />
157 <?php echo html_get_ccode_popup('ccode', $ccode); ?>
160 @<?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']); ?>
161 <br /><input size="30" type="text" name="email" value="<?php print(htmlspecialchars($email)); ?>" />
165 if ($sys_use_jabber) {
166 echo _('Jabber Address:').'<br />
167 <input size="30" type="text" name="jabber_address" value="'.
168 htmlspecialchars($jabber_address) .'" /><br />
169 <input type="checkbox" name="jabber_only" value="1" />
170 '._('Send auto-generated notices only to my Jabber address').'.';
175 <?php echo _('Address:'); ?><br />
176 <input type="text" name="address" value="<?php echo htmlspecialchars($address); ?>" size="80" />
179 <?php echo _('Address:'); ?><br />
180 <input type="text" name="address2" value="<?php echo htmlspecialchars($address2); ?>" size="80" />
183 <?php echo _('Phone:'); ?><br />
184 <input type="text" name="phone" value="<?php echo htmlspecialchars($phone); ?>" size="20" />
187 <?php echo _('FAX:'); ?><br />
188 <input type="text" name="fax" value="<?php echo htmlspecialchars($fax); ?>" size="20" />
191 <input type="checkbox" name="mail_site" value="1" checked="checked" />
192 <?php echo _('Receive Email about Site Updates <i>(Very low traffic and includes security notices. Highly Recommended.)</i>'); ?>
195 <input type="checkbox" name="mail_va" value="1" />
196 <?php echo _('Receive additional community mailings. <i>(Low traffic.)</i>'); ?>
198 <?php if ($GLOBALS['sys_require_accept_conditions']) { ?>
200 <input type="checkbox" name="accept_conditions" value="1" />
201 <?php printf (_('Do you accept the <a href="%1$s">terms of use</a> for this site?'),
202 util_make_url ('/terms.php')); ?>
206 <?php printf(_('Fields marked with %s are mandatory.'), utils_requiredField()); ?>
209 <input type="submit" name="submit" value="<?php echo _('Register'); ?>" />
212 <p><a href="pending-resend.php"><?php echo _('[Resend confirmation email to a pending account]'); ?></a></p>
214 <?php $HTML->footer(array());
218 // c-file-style: "bsd"