if (empty($stripped['handle']) || !preg_match('/^[0-9a-z_]{2,20}\\z/', $stripped['handle'])) { $errors[] = 'Username is invalid.'; $display_form = true; } if (empty($_POST['read_everything']['comments_read'])) { $errors[] = 'Obviously you did not read all the comments' . ' concerning the need for an account. Please read ' . 'them again.'; $display_form = true; } if (!isset($stripped['captcha']) || !isset($_SESSION['answer']) || $stripped['captcha'] != $_SESSION['answer']) { $errors[] = 'Incorrect CAPTCHA'; $display_form = true; } if ($errors) { break; } $request = new PEAR_Election_Accountrequest(); $salt = $request->addRequest($stripped['handle'], $stripped['email'], $stripped['firstname'], $stripped['lastname'], $stripped['password'], $stripped['password2']); if (PEAR::isError($salt)) { $errors[] = 'This email address has already been registered by another user'; $display_form = true; break; } if (isset($stripped['display_form'])) { $display_form = $stripped['display_form']; } if (is_array($salt)) { $errors = $salt; break; } elseif (strlen($salt) == 32) { report_success('Your account request confirmation has been submitted. ' . ' You must follow the link provided in the email ' . ' in order to activate your account.' . ' Until this is done you cannot vote in any election.'); $mailData = array('username' => $stripped['handle'], 'salt' => $salt);
if ($request->find($salt) && $request->pending()) { $email = $request->email; $user = $name = ''; $errors = array(); include PEARWEB_TEMPLATEDIR . '/bugs/registernewaccount.php'; response_footer(); exit; } else { report_error('Unknown salt'); } } else { report_error('Unknown salt'); } } else { echo '<h1>Confirm Account</h1>'; if (empty($stripped['salt']) || strlen($salt = htmlspecialchars($stripped['salt'])) != 32) { report_error('Unknown salt'); } else { $request = new PEAR_Election_Accountrequest(); $result = $request->confirmRequest($salt); if (PEAR::isError($result)) { report_error($result->getMessage()); } elseif ($result) { report_success('Your account has been activated, you can now vote in PEAR elections that are for the general PHP public as well as open bugs in the bug tracker'); } else { report_error('There was a problem activating your account, please contact ' . PEAR_WEBMASTER_EMAIL); } } } response_footer();