<?php
/**
* This file is part of php-agenda.
*
* php-agenda is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* php-agenda is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with php-agenda; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Copyright 2006-2007, Thomas Abeel
*
* Project: http://sourceforge.net/projects/php-agenda/
*
*/
?>
<?php
/**
* ForgotPass.php
*
* This page is for those users who have forgotten their
* password and want to have a new password generated for
* them and sent to the email address attached to their
* account in the database. The new password is not
* displayed on the website for security purposes.
*
* Note: If your server is not properly setup to send
* mail, then this page is essentially useless and it
* would be better to not even link to this page from
* your website.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 26, 2004
*/
include("include/session.inc.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title>The Simple PHP Agenda</title>
</head>
<body>
<?php
/**
* Forgot Password form has been submitted and no errors
* were found with the form (the username is in the database)
*/
if(isset($_SESSION['forgotpass'])){
/**
* New password was generated for user and sent to user's
* email address.
*/
if($_SESSION['forgotpass']){
echo "<h1>New Password Generated</h1>";
echo "<p>Your new password has been generated "
."and sent to the email <br>associated with your account. "
."<a href=\"../index.php\">Main</a>.</p>";
}
/**
* Email could not be sent, therefore password was not
* edited in the database.
*/
else{
echo "<h1>New Password Failure</h1>";
echo "<p>There was an error sending you the "
."email with the new password,<br> so your password has not been changed. "
."<a href=\"../index.php\">Main</a>.</p>";
}
unset($_SESSION['forgotpass']);
}
else{
/**
* Forgot password form is displayed, if error found
* it is displayed.
*/
?>
<h1>Forgot Password</h1>
A new password will be generated for you and sent to the email address<br>
associated with your account, all you have to do is enter your
username.<br><br>
<?php echo $form->error("user"); ?>
<form action="process.php" method="POST">
<b>Username:</b> <input type="text" name="user" maxlength="30" value="<?php echo $form->value("user"); ?>">
<input type="hidden" name="subforgot" value="1">
<input type="submit" value="Get New Password">
</form>
<?php
}
?>
</body>
</html>