33
27
if (!Config::get('allow_public_registration') || Config::get('demo_mode')) {
34
debug_event('DENIED','Error Attempted registration','1');
28
debug_event('DENIED','Error Attempted registration','1');
40
* These are only needed for this page so they aren't included in init.php
41
* this is for email validation and the cool little graphic
43
require_once Config::get('prefix') . '/modules/validatemail/validateEmailFormat.php';
44
require_once Config::get('prefix') . '/modules/validatemail/validateEmail.php';
46
33
/* Don't even include it if we aren't going to use it */
47
34
if (Config::get('captcha_public_reg')) {
48
define ("CAPTCHA_INVERSE", 1);
49
include Config::get('prefix') . '/modules/captcha/captcha.php';
35
define ("CAPTCHA_INVERSE", 1);
36
require_once Config::get('prefix') . '/modules/captcha/captcha.php';
53
40
/* Start switch based on action passed */
54
41
switch ($_REQUEST['action']) {
56
$username = scrub_in($_GET['username']);
57
$validation = scrub_in($_GET['auth']);
58
require_once Config::get('prefix') . '/templates/show_user_activate.inc.php';
62
* User information has been entered
63
* we need to check the database for possible existing username first
64
* if username exists, error and say "Please choose a different name."
65
* if username does not exist, insert user information into database
66
* then allow the user to 'click here to login'
67
* possibly by logging them in right then and there with their current info
68
* and 'click here to login' would just be a link back to index.php
70
$fullname = scrub_in($_POST['fullname']);
71
$username = scrub_in($_POST['username']);
72
$email = scrub_in($_POST['email']);
73
$pass1 = scrub_in($_POST['password_1']);
74
$pass2 = scrub_in($_POST['password_2']);
76
/* If we're using the captcha stuff */
77
if (Config::get('captcha_public_reg')) {
78
$captcha = captcha::solved();
79
if(!isset ($captcha)) {
80
Error::add('captcha', T_('Error Captcha Required'));
82
if (isset ($captcha)) {
87
Error::add('captcha', T_('Error Captcha Failed'));
89
} // end if we've got captcha
90
} // end if it's enabled
92
if (Config::get('user_agreement')) {
93
if (!$_POST['accept_agreement']) {
94
Error::add('user_agreement', T_("You <U>must</U> accept the user agreement"));
96
} // if they have to agree to something
98
if (!$_POST['username']) {
99
Error::add('username', T_("You did not enter a username"));
103
Error::add('fullname', T_("Please fill in your full name (Firstname Lastname)"));
106
/* Check the mail for correct address formation. */
111
while ( $response_code == "" || strstr( $response_code, "fsockopen error" )) {
112
$validate_results = validateEmail( $email );
113
$response_code = $validate_results[1];
114
if($attempt == $max_attempts) {
120
if ($validate_results[0] OR strstr($validate_results[1],"greylist")) {
124
Error::add('email', T_("Error Email address not confirmed")
125
. "<br />$validate_results[1]");
127
/* End of mailcheck */
130
Error::add('password', T_("You must enter a password"));
133
if ( $pass1 != $pass2 ) {
134
Error::add('password', T_("Your passwords do not match"));
137
if (!User::check_username($username)) {
138
Error::add('duplicate_user', T_("Error Username already exists"));
141
// If we've hit an error anywhere up there break!
142
if (Error::occurred()) {
143
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
147
/* Attempt to create the new user */
149
switch (Config::get('auto_user')) {
163
$new_user = User::create($username, $fullname, $email, $pass1,
164
$access, Config::get('admin_enable_required'));
167
Error::add('duplicate_user', T_("Error: Insert Failed"));
168
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
172
$client = new User($new_user);
173
$validation = md5(uniqid(rand(), true));
174
$client->update_validation($validation);
176
Registration::send_confirmation($username, $fullname, $email, $pass1, $validation);
177
require_once Config::get('prefix') . '/templates/show_registration_confirmation.inc.php';
179
case 'show_add_user':
181
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
43
$username = scrub_in($_GET['username']);
44
$validation = scrub_in($_GET['auth']);
45
require_once Config::get('prefix') . '/templates/show_user_activate.inc.php';
49
* User information has been entered
50
* we need to check the database for possible existing username first
51
* if username exists, error and say "Please choose a different name."
52
* if username does not exist, insert user information into database
53
* then allow the user to 'click here to login'
54
* possibly by logging them in right then and there with their current info
55
* and 'click here to login' would just be a link back to index.php
57
$fullname = scrub_in($_POST['fullname']);
58
$username = scrub_in($_POST['username']);
59
$email = scrub_in($_POST['email']);
60
$pass1 = scrub_in($_POST['password_1']);
61
$pass2 = scrub_in($_POST['password_2']);
63
/* If we're using the captcha stuff */
64
if (Config::get('captcha_public_reg')) {
65
$captcha = captcha::solved();
66
if(!isset ($captcha)) {
67
Error::add('captcha', T_('Error Captcha Required'));
69
if (isset ($captcha)) {
74
Error::add('captcha', T_('Error Captcha Failed'));
76
} // end if we've got captcha
77
} // end if it's enabled
79
if (Config::get('user_agreement')) {
80
if (!$_POST['accept_agreement']) {
81
Error::add('user_agreement', T_("You <U>must</U> accept the user agreement"));
83
} // if they have to agree to something
85
if (!$_POST['username']) {
86
Error::add('username', T_("You did not enter a username"));
90
Error::add('fullname', T_("Please fill in your full name (Firstname Lastname)"));
93
// Check the mail for correct address formation.
94
if (!Mailer::validate_address($email)) {
95
Error::add('email', T_('Invalid email address')
99
Error::add('password', T_("You must enter a password"));
102
if ( $pass1 != $pass2 ) {
103
Error::add('password', T_("Your passwords do not match"));
106
if (!User::check_username($username)) {
107
Error::add('duplicate_user', T_("Error Username already exists"));
110
// If we've hit an error anywhere up there break!
111
if (Error::occurred()) {
112
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
116
/* Attempt to create the new user */
118
switch (Config::get('auto_user')) {
132
$new_user = User::create($username, $fullname, $email, $pass1,
133
$access, Config::get('admin_enable_required'));
136
Error::add('duplicate_user', T_("Error: Insert Failed"));
137
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
141
$client = new User($new_user);
142
$validation = md5(uniqid(rand(), true));
143
$client->update_validation($validation);
145
Registration::send_confirmation($username, $fullname, $email, $pass1, $validation);
146
require_once Config::get('prefix') . '/templates/show_registration_confirmation.inc.php';
148
case 'show_add_user':
150
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
183
152
} // end switch on action