isLoggedIn()) { // User must be logged out to view this page Redirect::to("/"); die(); } else { $siteemail = $queries->getWhere("settings", array("name", "=", "outgoing_email")); $siteemail = $siteemail[0]->value; if(Input::exists()) { if(Token::check(Input::get('token'))) { $check = $queries->getWhere('users', array('username', '=', Input::get('username'))); if(count($check)){ $code = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 60); $to = $check[0]->email; $subject = 'Password Reset'; $message = 'Hello, ' . htmlspecialchars($check[0]->username) . ' You are receiving this email because you requested a password reset. In order to reset your password, please use the following link: http://' . $_SERVER['SERVER_NAME'] . '/change_password/?c=' . $code . ' If you did not request the password reset, please ignore this email. Thanks, ' . $sitename . ' staff.'; $headers = 'From: ' . $siteemail . "\r\n" . 'Reply-To: ' . $siteemail . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $queries->update('users', $check[0]->id, array( 'reset_code' => $code )); Session::flash('info', '
Success. Please check your emails for further instructions.
'); Redirect::to("/"); } else { Session::flash('error', '
That username does not exist.
'); } } else { Session::flash('error', '
Error processing your request.
'); } } ?> <?php echo $sitename; ?> • Forgot Password

Forgot Password