must accept the user agreement"));
}
} // if they have to agree to something
if (!$_POST['username']) {
Error::add('username',_("You did not enter a username"));
}
if(!$fullname) {
Error::add('fullname',_("Please fill in your full name (Firstname Lastname)"));
}
/* Check the mail for correct address formation. */
$attempt = 0;
$max_attempts = 3;
$response_code = "";
while ( $response_code == "" || strstr( $response_code, "fsockopen error" )) {
$validate_results = validateEmail( $email );
$response_code = $validate_results[1];
if($attempt == $max_attempts) {
break;
}
$attempt++;
}
if ($validate_results[0] OR strstr($validate_results[1],"greylist")) {
$mmsg = "MAILOK";
}
else {
Error::add('email',_("Error Email address not confirmed
$validate_results[1]"));
}
/* End of mailcheck */
if (!$pass1) {
Error::add('password',_("You must enter a password"));
}
if ( $pass1 != $pass2 ) {
Error::add('password',_("Your passwords do not match"));
}
if (!User::check_username($username)) {
Error::add('duplicate_user',_("Error Username already exists"));
}
// If we've hit an error anywhere up there break!
if (Error::occurred()) {
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
break;
}
/* Attempt to create the new user */
$access = '5';
switch (Config::get('auto_user')) {
case 'admin':
$access = '100';
break;
case 'user':
$access = '25';
break;
default:
case 'guest':
$access = '5';
break;
} // auto-user level
$new_user = User::create($username,$fullname,$email,$pass1,$access);
if (!$new_user) {
Error::add('duplicate_user',_("Error: Insert Failed"));
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
break;
}
$client = new User($new_user);
$validation = md5(uniqid(rand(), true));
$client->update_validation($validation);
Registration::send_confirmation($username, $fullname, $email, $pass1, $validation);
require_once Config::get('prefix') . '/templates/show_registration_confirmation.inc.php';
break;
case 'show_add_user':
default:
require_once Config::get('prefix') . '/templates/show_user_registration.inc.php';
break;
} // end switch on action
?>
80'>80