must enter a username, password and e-mail address.'); // Check if passwords match } elseif (POST_PASS != POST_PASS2) { $tplVars['error'] = T_('Those passwords do not match.'); // Check if username is reserved } elseif ($userservice->isReserved($posteduser)) { $tplVars['error'] = T_('This username has been reserved, please make another choice.'); // Check if username already exists } elseif ($userservice->getUserByUsername($posteduser)) { $tplVars['error'] = T_('This username already exists, please make another choice.'); // Check if username is valid (length, authorized characters) } elseif (!$userservice->isValidUsername($posteduser)) { $tplVars['error'] = T_('This username is not valid (too short, too long, forbidden characters...), please make another choice.'); // Check if e-mail address is valid } elseif (!$userservice->isValidEmail(POST_MAIL)) { $tplVars['error'] = T_('E-mail address is not valid. Please try again.'); // Check if antispam answer is valid (doesn't take into account spaces and uppercase) } elseif (strcasecmp(str_replace(' ', '', POST_ANTISPAMANSWER), str_replace(' ', '', $GLOBALS['antispamAnswer'])) != 0) { $tplVars['error'] = T_('Antispam answer is not valid. Please try again.'); // Register details } else { $uId = $userservice->addUser($posteduser, POST_PASS, POST_MAIL); if ($uId !== false) { if (isset($_SERVER['SSL_CLIENT_VERIFY']) && $_SERVER['SSL_CLIENT_VERIFY'] == 'SUCCESS' ) { $ssl = SemanticScuttle_Service_Factory::get('User_SslClientCert'); $ssl->registerCurrentCertificate($uId); $ssl->updateProfileFromCurentCert($uId); } // Log in with new username $login = $userservice->login($posteduser, POST_PASS); if ($login) { header('Location: '. createURL('bookmarks', $posteduser)); } $tplVars['msg'] = T_('You have successfully registered. Enjoy!'); } else { $tplVars['error'] = T_('Registration failed. Please try again.'); } } } $tplVars['antispamQuestion'] = $GLOBALS['antispamQuestion']; $tplVars['loadjs'] = true; $tplVars['subtitle'] = T_('Register'); $tplVars['formaction'] = createURL('register'); $templateservice->loadTemplate('register.tpl', $tplVars); ?>