<hgroup class="align-vertical"> <h1>FORGOTTEN YOUR PASSWORD</h1> </hgroup> </header> <main> <section> <div class="section-padding align-centre lgrey"> <?php require_once 'php/LoginSystem.php'; $loginSystem = new LoginSystem(); if ($_POST) { $email = $_POST['email']; if (!empty($email)) { $exists = $loginSystem->checkUserExists($email, ''); if ($exists) { $response = $loginSystem->sendResetPasswordLink($email); echo $response; } else { echo '<p class="full warn"><i class="ico-warning"></i>No account with this email exists.</p>'; } } else { echo '<p class="full warn"><i class="ico-warning"></i>Please enter your email.</p>'; } } ?> <form method="post"> <table> <tr>
<h1>REGISTER</h1> <?php require_once 'php/ProfanityFilter.php'; $wrapStart = '<p class="full warn"><i class="ico-warning"></i>'; $wrapEnd = '</p>'; if (!empty($_POST['register-submit'])) { $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $emailAgain = $_POST['email-again']; $passwordAgain = $_POST['password-again']; if (!empty($username) && !empty($email) && !empty($password) && !empty($emailAgain) && !empty($passwordAgain)) { if (preg_match('/^[a-zA-Z0-9]+$/', $username)) { if ($email === $emailAgain && $password === $passwordAgain) { $exists = $loginSystem->checkUserExists($email, $username); if ($exists) { echo $wrapStart . 'An account with this email/username already exists.' . $wrapEnd; } else { if (!ProfanityFilter::containsProfanity($username)) { $response = $loginSystem->createUser($email, $password, $username); echo $response; } else { echo $wrapStart . 'No profanity please.' . $wrapEnd; } } } else { echo $wrapStart . 'Email and/or password did not match. Please try again.' . $wrapEnd; } } else { echo $wrapStart . 'Username must be alphanumeric (a-z A-Z 0-9) with no spaces.' . $wrapEnd;