forget your password?"); } if(empty($_POST['password']) || strlen($_POST['password']) < 8) { flash_error("You did not enter a valid password. Your password has to be at least 8 characters."); } elseif(empty($_POST['password2']) || $_POST['password'] != $_POST['password2']) { flash_error("The passwords you entered did not match."); } if(!empty($_POST['displayname']) && User::CheckIfDisplayNameExists($_POST['displayname'])) { flash_error("The (display) name you entered is already in use. Please pick a different name. You can also just use your nickname!"); } if(count(get_errors(false)) == 0) { $sUser = new User(0); $sUser->uUsername = $_POST['username']; $sUser->uDisplayName = (!empty($_POST['displayname'])) ? $_POST['displayname'] : $_POST['username']; $sUser->uPassword = $_POST['password']; $sUser->uEmailAddress = $_POST['email']; $sUser->uActivationKey = random_string(16); $sUser->GenerateSalt(); $sUser->GenerateHash(); $sUser->InsertIntoDatabase(); send_mail($_POST['email'], "Please confirm your registration at ReDonate.", NewTemplater::Render("email/signup.txt", $locale->strings, array( "confirmation-url" => "http://redonate.net/confirm/{$sUser->sEmailAddress}/{$sUser->sActivationKey}/", "name" => $sUser->uDisplayName)), /* we don't want a HTML-entities-encoded version here */ NewTemplater::Render("email/layout.html", $locale->strings, array( "contents" => NewTemplater::Render("email/signup.html", $locale->strings, array( "confirmation-url" => "http://redonate.net/confirm/{$sUser->sEmailAddress}/{$sUser->sActivationKey}/", "name" => $sUser->sDisplayName)) )) ); $sPageContents = NewTemplater::Render("signup/success", $locale->strings, array()); $sPageTitle = "Thanks for signing up!"; return; } } $sPageContents = NewTemplater::Render("signup/form", $locale->strings, array()); $sPageTitle = "Sign up";