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 (forge_get_config('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(forge_get_config('default_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 = forge_get_config('default_timezone') ? forge_get_config('default_timezone') : 'GMT' ;
107 if (!isset($ccode) || empty($ccode) || !preg_match('/^[a-zA-Z]{2}$/', $ccode)) {
108 $ccode = forge_get_config('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); ?>
161 echo _('Email Address:') . utils_requiredField() . "<br />\n<em>";
162 printf(_('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.'), $GLOBALS['sys_users_host']); ?></em>
163 <br /><input size="30" type="text" name="email" value="<?php print(htmlspecialchars($email)); ?>" />
167 if ($sys_use_jabber) {
168 echo _('Jabber Address:').'<br />
169 <input size="30" type="text" name="jabber_address" value="'.
170 htmlspecialchars($jabber_address) .'" /><br />
171 <input type="checkbox" name="jabber_only" value="1" />
172 '._('Send auto-generated notices only to my Jabber address').'.';
177 <?php echo _('Address:'); ?><br />
178 <input type="text" name="address" value="<?php echo htmlspecialchars($address); ?>" size="80" />
181 <?php echo _('Address:'); ?><br />
182 <input type="text" name="address2" value="<?php echo htmlspecialchars($address2); ?>" size="80" />
185 <?php echo _('Phone:'); ?><br />
186 <input type="text" name="phone" value="<?php echo htmlspecialchars($phone); ?>" size="20" />
189 <?php echo _('FAX:'); ?><br />
190 <input type="text" name="fax" value="<?php echo htmlspecialchars($fax); ?>" size="20" />
193 <input type="checkbox" name="mail_site" value="1" checked="checked" />
194 <?php echo _('Receive Email about Site Updates <i>(Very low traffic and includes security notices. Highly Recommended.)</i>'); ?>
197 <input type="checkbox" name="mail_va" value="1" />
198 <?php echo _('Receive additional community mailings. <i>(Low traffic.)</i>'); ?>
200 <?php if ($GLOBALS['sys_require_accept_conditions']) { ?>
202 <input type="checkbox" name="accept_conditions" value="1" />
203 <?php printf (_('Do you accept the <a href="%1$s">terms of use</a> for this site?'),
204 util_make_url ('/terms.php')); ?>
208 <?php printf(_('Fields marked with %s are mandatory.'), utils_requiredField()); ?>
211 <input type="submit" name="submit" value="<?php echo _('Register'); ?>" />
214 <p><a href="pending-resend.php"><?php echo _('[Resend confirmation email to a pending account]'); ?></a></p>
216 <?php $HTML->footer(array());
220 // c-file-style: "bsd"