forget your password?"; } if(empty($_POST['password']) || strlen($_POST['password']) < 8) { $sErrors[] = "You did not enter a valid password. Your password has to be at least 8 characters."; } elseif(empty($_POST['password2']) || $_POST['password'] != $_POST['password2']) { $sErrors[] = "The passwords you entered did not match."; } if(!empty($_POST['displayname']) && User::CheckIfDisplayNameExists($_POST['displayname'])) { $sErrors[] = "The (display) name you entered is already in use. Please pick a different name. You can also just use your nickname!"; } if(empty($sErrors)) { $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.cryto.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.cryto.net/confirm/{$sUser->sEmailAddress}/{$sUser->sActivationKey}/", "name" => $sUser->sDisplayName)) )) ); $sPageContents = NewTemplater::Render("signup/success", $locale->strings, array()); return; } } $sPageContents = NewTemplater::Render("signup/form", $locale->strings, array('errors' => $sErrors));