libHTML::notice(l_t("Opt-out"), l_t("Would you like to opt back into running the Plura Java applet?") . "<br />\r\n\t\t\t<form><input type='submit' class='form-submit' name='optout' value='" . l_t('Opt-in') . "' /></form>"); } elseif ($_REQUEST['optout'] == l_t('Opt-in') && $User->type['Donator']) { $types = array(); foreach ($User->type as $type => $isMember) { if ($isMember && $type != 'Donator') { $types[] = $type; } } $types = implode(',', $types); $DB->sql_put("UPDATE wD_Users SET type = '" . $types . "' WHERE id = " . $User->id); $User->type['Donator'] = false; libHTML::notice(l_t("Opt-out"), l_t("You've decided to re-add the Plura applet, thanks! By running the Plura applet you " . "help keep this server running.")); } } if (isset($_REQUEST['emailToken'])) { if (!($email = libAuth::emailToken_email($_REQUEST['emailToken']))) { libHTML::notice(l_t("E-mail change validation"), l_t("A bad e-mail token was given, please check the validation link try again")); } $email = $DB->escape($email); if (User::findEmail($email)) { libHTML::notice(l_t("E-mail change validation"), l_t("The given e-mail address is already in use, please use a unique e-mail address")); } $DB->sql_put("UPDATE wD_Users SET email='" . $email . "' WHERE id = " . $User->id); $User->email = $email; print '<div class="content"><p class="notice">' . l_t('Your e-mail address has been succesfully changed') . '</p></div>'; } if (isset($_REQUEST['userForm'])) { $formOutput = ''; try { $errors = array(); $SQLVars = User::processForm($_REQUEST['userForm'], $errors);
<li class="formlistdesc">' . l_t('The webDiplomacy username of the account which you can\'t log in to.') . '</li> <li><input type="submit" class="form-submit" value="' . l_t('Send code') . '"></li> </ul> </form>'; } elseif ($_REQUEST['forgotPassword'] == 2 && isset($_REQUEST['forgotUsername'])) { try { $forgottenUser = new User(0, $DB->escape($_REQUEST['forgotUsername'])); } catch (Exception $e) { throw new Exception(l_t("Cannot find an account for the given username, please " . "<a href='logon.php?forgotPassword=1' class='light'>go back</a> and check your spelling.")); } require_once l_r('objects/mailer.php'); $Mailer = new Mailer(); $Mailer->Send(array($forgottenUser->email => $forgottenUser->username), l_t('webDiplomacy forgotten password verification link'), l_t("You can use this link to get a new password generated:") . "<br>\r\n" . libAuth::email_validateURL($forgottenUser->email) . "&forgotPassword=3<br><br>\r\n\r\n" . l_t("If you have any further problems contact the server's admin at %s.", Config::$adminEMail) . "<br>"); print '<p>' . l_t('An e-mail has been sent with a verification link, which will allow you to have your password reset. ' . 'If you can\'t find the e-mail in your inbox try your junk folder/spam-box.') . '</p>'; } elseif ($_REQUEST['forgotPassword'] == 3 && isset($_REQUEST['emailToken'])) { $email = $DB->escape(libAuth::emailToken_email($_REQUEST['emailToken'])); $userID = User::findEmail($email); $newPassword = base64_encode(rand(1000000000, 2000000000)); $DB->sql_put("UPDATE wD_Users\r\n\t\t\t\tSET password=UNHEX('" . libAuth::pass_Hash($newPassword) . "')\r\n\t\t\t\tWHERE id=" . $userID . " LIMIT 1"); print '<p>' . l_t('Thanks for verifying your address, this is your new password, which you can ' . 'change once you have logged back on:') . '<br /><br /> <strong>' . $newPassword . '</strong></p> <p><a href="logon.php" class="light">' . l_t('Back to log-on prompt') . '</a></p>'; } } catch (Exception $e) { print '<p class="notice">' . $e->getMessage() . '</p>'; } print '</div>'; libHTML::footer(); }